Jump to content

OutlookEX UDF - Help & Support (III)


water
 Share

Recommended Posts

To make it waterproof you should use MS Word to process the body. An example can be found in _OL_ItemCreate.au3 (example 1).

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

On 19/08/2017 at 6:58 AM, water said:

To make it waterproof you should use MS Word to process the body. An example can be found in _OL_ItemCreate.au3 (example 1).

I know, but this is a step over, first I need to find why I can't run on another pc, 

if I run the on of the create example I get some type error 

 

Link to comment
Share on other sites

The error you get seems to be caused by me. I forgot to fix the example function.

$sCurrentUser = $oOL.GetNameSpace("MAPI").CurrentUser.Name

should be

$sCurrentUser = $oOL.GetNameSpace("MAPI").CurrentUser

in function _OL_TestEnvironmentCreate.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

The wiki describes some causes of problems: https://www.autoitscript.com/wiki/OutlookEX_UDF_-_General#Debugging

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

  • 3 weeks later...

Hi

Great fun! Thanks.

I keep on getting errors on the TestEnvironment, but for my purposes that is not the most important.  Will deal with that later.

Your documentation is good.  I do however have this suggestion: Make a __Example.au3 file to run first, with the basics?  Yes, I found all the examples, but the problem is, Where to start? :)

 

I have an issue.  It seems from what I read above others have the same issue, but I am not sure what the solution is...?  Problem - I have multiple profiles for Outlook.  Private and professional.  The "default" sender profile is my private profile and I want to use a different profile to send.  You posted  this link -- is that the only way?  Why not simply specify "sender" as a variable?

Some additional info.  I use Outlook 2013.  I use POP/SMTP accounts.  The Outlook "Default" sending account, is NOT the same as that picked up by the UDF.

Also, _OL_AccountGet() returns all my email accounts.  I can not see any relationship between the data in the array and the 'default' account selected to send the mail on.  It is as if Outlook defaults to a setting that I can't see?

I should add that this works, BUT it still sends with the 'wrong' default sender, it now simply adds 'on behalf of' my specified sender...

If the answer is obvious, please just point me in the right direction? 

Thanks.

 

Skynake

 

Edited by Skysnake

Skysnake

Why is the snake in the sky?

Link to comment
Share on other sites

With _OL_Open you can specify the profile to use. Then you should be able to select the account to send from.
According to MSDN "first Exchange account added to the profile is the primary Exchange account, and is also the default account for the session". So the first entry in the array returned by _OL_AccountGet.au3 should be the default account in the current profile.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Thanks for the reply.

I figured as much.  However, the Array returned by AccountGet above returns the default account somewhere in the middle... Is there a way I can force the selection of the account? Alternatively edit the order of those accounts?

On this point I need to point our that I can't find a .prf file on my system... :(

In case anyone else is reading - the mail send works, all I want to do is select a DIFFERENT sender account from the current profile.

So far the best work around is the _OL_Wrapper_SendMailBehalf().  Best outcome would be to select the Sender. 

Thanks

Skysnake

Edited by Skysnake

Skysnake

Why is the snake in the sky?

Link to comment
Share on other sites

Quote

returns the default account somewhere in the middle

In this case Microsofts statement isn't true.

You can set mail property "SendUsingAccount" to the Account object returned by _OL_AccountGet in element 4 to select another account as sender.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Microsoft tells me that the first account in the list is the default account (as returned by _OL_Accountget). You tell me that the default account is somewhere in the middle of the list.
For me MS statement is correct. But for your site it doesn't seem to be true.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

 Maybe I miss something? :)

ConsoleWrite("$aResult[1][3] " &$aResult[1][3]& @CRLF)

Returns my display name.  [1][4] returns blank -> Column 4 is blank (all nine lines)

 

Found this:

I have multiple .pst files set up to service the various email accounts.  I have now set the preferred email address as default for each.  Now it sends with the preferred email address. :)

I guess that the AccountGet() simply grabs all, or the most recent and does not distinguish...  I also guess that for a single account IMAP user this would be an unlikely scenario.

Anyway, thank you for your prompt response. Helped me find what I was looking for :)

 

Skysnake

Edited by Skysnake

Skysnake

Why is the snake in the sky?

Link to comment
Share on other sites

Quote

Returns my display name.

Then the MS statement is true for you as well. Line 0 contains the line/row count.
Element 4 of each line is an object which can't be displayed on the screen.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Okay thanks.

Now, I managed to get the result I wanted with fiddling my Outlook.  Is it possible to show some code that will set the Sender using that object you refer to?

This did not seem to have any effect.  Where [2] is a second email address to test...

$aResult = _OL_AccountGet($oOutlook)

 $oOutlook.SendUsingAccount = $aResult[2][4]

Skysnake

Skysnake

Why is the snake in the sky?

Link to comment
Share on other sites

Will check how it works here - have never used it before ;) 

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

And now for something complete different::
The following script should list all Outlook profiles including the default profile. Does this work for you as well?

#include <OutlookEX.au3>
Global $aErrorMsgNeg[] = ["value type not supported", _ ; @error = -2
        "unable to open requested value"] ; @error = -1
Global $aErrorMsgPos[] = ["unable to open requested key", _ ; @error = 1
        "unable to open requested main key", _ ; @error = 2
        "unable to remote connect to the registry"] ; @error = 3
Global $oOL = _OL_Open()

Local $i = 1, $sProfile
Local $aVersion = StringSplit($oOL.Version, '.')
Local $sRegKey = "HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles" ; Outlook 97 to 2010
If Int($aVersion[1]) >= 15 Then $sRegKey = "HKEY_CURRENT_USER\Software\Microsoft\Office\" & Int($aVersion[1]) & "." & Int($aVersion[2]) & "\Outlook\Profiles" ; Beginning with Outlook 2013
Local $sDefaultProfile = RegRead($sRegKey, "DefaultProfile")
If @error Then
    If @error < 0 Then
        ConsoleWrite("RegRead returned @error = " & @error & ": " & $aErrorMsgNeg[@error + 2] & @CRLF)
    Else
        ConsoleWrite("RegRead returned @error = " & @error & ": " & $aErrorMsgPos[@error - 1] & @CRLF)
    EndIf
Else
    ConsoleWrite("Default Outlook profile: " & $sDefaultProfile & @CRLF)
EndIf

While 1
    $sProfile = RegEnumKey("HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles", $i)
    If @error Then ExitLoop
    ConsoleWrite("Outlook profile " & $i & ": " & $sProfile & @CRLF)
    $i = $i + 1
WEnd

 

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Returns

>Running:(3.3.14.2):C:\Program Files (x86)\AutoIt3\autoit3.exe "C:\AutoIt\OutLookUDF\GetAllProfiles.au3"    
--> Press Ctrl+Alt+Break to Restart or Ctrl+Break to Stop
Default Outlook profile: Outlook
Outlook profile 1: Outlook
+>16:54:28 AutoIt3.exe ended.rc:0
+>16:54:28 AutoIt3Wrapper Finished.
>Exit code: 0    Time: 0.8072

 

Skysnake

Why is the snake in the sky?

Link to comment
Share on other sites

IIRC we discussed this issue some time ago:

 

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Hi, thanks.  Is there a definitive list of AutoIt error codes for this UDF? Now getting Error 4400... :(

Found it. 

; Return values .: Success - Object of the sent mail
;                  Failure - Returns 0 and sets @error:
;                  |1    - $iBodyFormat is not a number
;                  |2    - $sBody is missing
;                  |4    - $sTo, $sCc and $sBCc are missing
;                  |1xxx - Error returned by function _OL_FolderAccess
;                  |2xxx - Error returned by function _OL_ItemCreate
;                  |3xxx - Error returned by function _OL_ItemModify
;                  |4xxx - Error returned by function _OL_ItemRecipientAdd
;                  |5xxx - Error returned by function _OL_ItemAttachmentAdd
;                  |6xxx - Error returned by function _OL_ItemSend

Error 4400 means bad "To" address specified :)

$iBodyFormat options? 

Also found

; OlBodyFormat Enumeration. Specifies the format of the body text of an item.
; See: http://msdn.microsoft.com/en-us/library/bb208058(v=office.12).aspx
Global Const $olFormatHTML = 2 ; HTML format
Global Const $olFormatPlain = 1 ; Plain format
Global Const $olFormatRichText = 3 ; Rich text format
Global Const $olFormatUnspecified = 0 ; Unspecified format

--> any tips on RTF format?

 

Its great fun :)

Skysnake

 

 

Edited by Skysnake

Skysnake

Why is the snake in the sky?

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

×
×
  • Create New...