Jump to content

OutlookEX UDF - Help & Support (III)


water
 Share

Recommended Posts

You are sure that Outlook is installed on the machine you run the script?

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...

I am hoping there is a way to return the mailbox address for stores that are not "cached Exchange" stores and are not a .PST or .OST.  I am using _OL_StoreGet() to get a list of stores, but mailboxes that are added as "additional mailboxes" only show the "Display Name" not the actual mailbox address.  Is there a way to find the mailbox address for these types of stores?

Func _GetOutlookStores_EX()
   Local $oOutlook = _OL_Open()
   If @error <> 0 Then Return ""

   Local $aResult = _OL_StoreGet($oOutlook)
   _OL_Close($oOutlook)

   Return $aResult
EndFunc
 
 
 
 
 
Link to comment
Share on other sites

Does function _OL_AccountGet return the needed information?

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 Water, thank you for replying

 

Does function _OL_AccountGet return the needed information?

 

Unfortunately, it does not, it only shows the email accounts.  It does not show anything that is added as an "additional mailbox"... maybe that is by design as "additional mailbox" data is stored in the same .OST file as the primary email account it is added from.

I forgot to mention I am using Outlook 2013... 

I have 2 mailboxes, added as separate email accounts: BRIK783@kellyservices.com, HARDWARE@kellyservices.com

I have also added 1 "Additional Mailbox" under the email account: BRIK783@kellyservices.com.  That is the one that shows up as MAILBOX HARDWARE SUPPORT when I run _OL_StoreGet... Having the Mailbox Display name is nice to have, but what I really need is the mailbox address that is needed to add the mailbox as a separate email account in Outlook 2013.

The reason for all this is, I am writing a script that will get a list of all the mailboxes that are added as an "Additional Mailbox", remove them and then add them as a full email account.  This way each mailbox will have it's own .OST and not share an .OST

I run both functions and return the following info:

Local $aStores = _GetOutlook2013Stores_EX()
_ArrayDisplay($aStores, "$aStores")


Local $aAccounts = _GetOutlook2013Accounts_EX()
_ArrayDisplay($aAccounts, "$aAccounts")


; ---------------------------------------------------------
Func _GetOutlook2013Stores_EX()
; ---------------------------------------------------------
Local $oOutlook = _OL_Open()
If @error <> 0 Then Return ""


Local $aResult = _OL_StoreGet($oOutlook)
_OL_Close($oOutlook)


Return $aResult
EndFunc   ;==>_GetOutlook2013Stores_EX


; ---------------------------------------------------------
Func _GetOutlook2013Accounts_EX()
; ---------------------------------------------------------
Local $oOutlook = _OL_Open()
If @error <> 0 Then Return ""


Local $aResult = _OL_AccountGet($oOutlook)
_OL_Close($oOutlook)


Return $aResult
EndFunc   ;==>_GetOutlook2013Accounts_EX

Results from $aStores:

Row|Col 0|Col 1|Col 2|Col 3|Col 4|Col 5|Col 6|Col 7|Col 8
[0]|4|9|||||||
[1]|BRIK783@kellyservices.com|0|C:Usersbrik783AppDataLocalMicrosoftOutlookBRIK783@kellyservices.com.ost|True|True|True|True|0000000038A1BB1005E5101AA1BB08002B2A56C20000454D534D44422E444C4C00000000000000001B55FA20AA6611CD9BC800AA002FC45A0C0000004252494B373833406B656C6C7973657276696365732E636F6D002F6F3D45786368616E67654C6162732F6F753D45786368616E67652041646D696E6973747261746976652047726F7570202846594449424F484632335350444C54292F636E3D526563697069656E74732F636E3D31386236313531353565306234323336616362346436646533366162613239622D4252494B373833406B656C6C7973657276696365732E636F6D00E94632F44600000002000000100000004200520049004B0037003800330040006B0065006C006C007900730065007200760069006300650073002E0063006F006D0000000000|False
[2]|SharePoint Lists|3||False|False|True|True|0000000038A1BB1005E5101AA1BB08002B2A56C200006D737073742E646C6C00000000004E495441F9BFB80100AA0037D96E0000000043003A005C00550073006500720073005C006200720069006B003700380033005C0041007000700044006100740061005C004C006F00630061006C005C004D006900630072006F0073006F00660074005C004F00750074006C006F006F006B005C005300680061007200650050006F0069006E00740020004C0069007300740073002E007000730074000000|
[3]|HARDWARE@kellyservices.com|4|C:Usersbrik783AppDataLocalMicrosoftOutlookhardware@kellyservices.com.ost|True|True|True|True|0000000038A1BB1005E5101AA1BB08002B2A56C20000454D534D44422E444C4C00000000000000001B55FA20AA6611CD9BC800AA002FC45A0C0000004841524457415245406B656C6C7973657276696365732E636F6D002F6F3D45786368616E67654C6162732F6F753D45786368616E67652041646D696E6973747261746976652047726F7570202846594449424F484632335350444C54292F636E3D526563697069656E74732F636E3D31353262663637353464333434383137613339616239363835303131373166332D4841524457415245406B656C6C7973657276696365732E636F6D00E94632F44800000002000000100000004800410052004400570041005200450040006B0065006C006C007900730065007200760069006300650073002E0063006F006D0000000000|
[4]|Mailbox Hardware Support|1||False|False|True|True|0000000038A1BB1005E5101AA1BB08002B2A56C20000454D534D44422E444C4C00000000000000001B55FA20AA6611CD9BC800AA002FC45A0C0000004841524457415245406B656C6C7973657276696365732E636F6D002F6F3D45786368616E67654C6162732F6F753D45786368616E67652041646D696E6973747261746976652047726F7570202846594449424F484632335350444C54292F636E3D526563697069656E74732F636E3D31353262663637353464333434383137613339616239363835303131373166332D4841524457415245406B656C6C7973657276696365732E636F6D00E94632F44800000002000000100000004800410052004400570041005200450040006B0065006C006C007900730065007200760069006300650073002E0063006F006D0000000000|False
 
 
Results from $aAccounts:
 
Row|Col 0|Col 1|Col 2|Col 3|Col 4|Col 5|Col 6|Col 7|Col 8
[0]|2|9|||||||
[1]|0|BRIK783@kellyservices.com|BRIK783@kellyservices.com|BRIK783||1|700|B3FACE32-402E-4E84-83B4-76EDF39FBFDE@KELLYSERVICES.COM|15.1.75.0
[2]|0|hardware@kellyservices.com|HARDWARE@kellyservices.com|HARDWARE||1|700|22f6fe66-c0d7-4326-9c12-5f960db6c347@kellyservices.com|15.1.81.17
 
Link to comment
Share on other sites

 

but what I really need is the mailbox address that is needed to add the mailbox as a separate email account in Outlook 2013.

I have no access to Outlook at the moment but I think what you need is the path. In Outlook you do a right click on the mailbox and get something like "xxxxx".

Maybe the inboxes could be enumerated and the path of the parent (= Mailbox) be retrieved.

AFAIK you can't add a new account by using COM.

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

 

In Outlook you do a right click on the mailbox and get something like "xxxxx".

Maybe the inboxes could be enumerated and the path of the parent (= Mailbox) be retrieved.

 

Yes, thank you - that was it... much appreciated.  

I can run _OL_FolderGet, pass the folder name "mailbox hardware support" and I get the following info:

Row|Col 0
[0]|18
[1]|
[2]|0
[3]|0000000038A1BB1005E5101AA1BB08002B2A56C20000454D534D44422E444C4C00000000000000001B55FA20AA6611CD9BC800AA002FC45A0C0000004841524457415245406B656C6C7973657276696365732E636F6D002F6F3D45786368616E67654C6162732F6F753D45786368616E67652041646D696E6973747261746976652047726F7570202846594449424F484632335350444C54292F636E3D526563697069656E74732F636E3D31353262663637353464333434383137613339616239363835303131373166332D4841524457415245406B656C6C7973657276696365732E636F6D00E94632F44800000002000000100000004800410052004400570041005200450040006B0065006C006C007900730065007200760069006300650073002E0063006F006D0000000000
[4]|000000006A9A0E0872B04A4985F6C07747D6A5A3010046106F0ECE6F394ABF209244AAF3F7F7014E4D7A51260000
[5]|Mailbox Hardware Support
[6]|HARDWARE@kellyservices.com
[7]|0
[8]|0
[9]|
[10]|False
[11]|IPM.Note
[12]|
[13]|False
[14]|False
[15]|False
[16]|1
[17]|False
[18]|
Link to comment
Share on other sites

 

Yes, thank you - that was it... much appreciated.

Glad to be of service :)

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

I am creating a backup script to save my emails for mulitple accounts, but I am having issues with the _OL_ItemSave function. It is returning @error = 6 and im failing to find a fix. I get a list of all folders then loop through them grabbing every email. I am able to see the emails but when it comes time to save it shows as invalid or empty. Any help would be greatly appreciated.
 
Global $oOutlook = _OL_Open()

Global $folders = _OL_FolderTree($oOutlook, "email@gmail.com\Inbox") ; Get a list of folders
_ArrayDisplay($folders) ; Test that all folders were found

For $a = 0 to UBound($folders) - 1
    Global $tempfolder = StringReplace($folders[$a], "\\email@gmail.com", "") ; Had to remove the double slashes for item find to work
    Global $aItems = _OL_ItemFind($oOutlook, StringReplace($folders[$a], "\\", ""), $olMail)
    _ArrayDisplay($aItems) ; Verify emails were found
    For $b = 1 to UBound($aItems) - 1
        If UBound($aItems) > 1 Then ; skip empty folders
            If Not FileExists("D:\Email Backups\Test" & $tempfolder) Then
                DirCreate("D:\Email Backups\Test" & $tempfolder)
            EndIf
            _OL_ItemSave($oOutlook, $aItems[$b][0], Default, "D:\Email Backups\Test\", $olMSG, 3)
            If @error <> 0 Then Exit MsgBox(16, "OutlookEX UDF: _OL_ItemSave Example Script", "Error saving mail item to D:\Backup Emails\Test. @error = " & @error & ", @extended = " & @extended)
        EndIf
    Next
Next
Link to comment
Share on other sites

Error 6 stands for: No or an invalid item has been specified

I think $aItems[$b][1] is correct for _OL_ItemSave. Because _OL_ItemFind returns a 2D array with the property name in column 0 and the valu in column 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

Thank you for the reply Water I really appreciate your help. Unfortunately changing $aItems[$b][0] to $aItems[$b][1] still produces the same error message. In my _ArrayDisplay($aItems) before my second loop it shows column 0 as the message subject, column 1 as the message body, column 2 and 3 seem to be the date and time, and I am not sure what column 4 is, maybe the message size?

Link to comment
Share on other sites

Sorry, my bad.

If you do not specify the properties to be returned the function defaults to "Subject,Body,CreationTime,LastModificationTime,Size". You need to specify at least EntryID so the next function can grab the mail.

Global $aItems = _OL_ItemFind($oOutlook, StringReplace($folders[$a], "\\", ""), $olMail, "", "", "", "EntryID")

should do the trick. Then

_OL_ItemSave($oOutlook, $aItems[$b][0], Default, "D:\Email Backups\Test\", $olMSG, 3)

is fine again.

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

After making the changes

Global $aItems = _OL_ItemFind($oOutlook, StringReplace($folders[$a], "\\", ""), $olMail, "", "", "", "EntryID")

now returns a 1 dimensional array so I changed the second part to

_OL_ItemSave($oOutlook, $aItems[$b], Default, "D:\Email Backups\Test\", $olMSG, 3)

but now I receive an error:

"C:UsersusersDesktopoutlook test.au3" (23) : ==> Array variable has incorrect number of subscripts or subscript dimension range exceeded.:
_OL_ItemSave($oOutlook, $aItems[$b], Default, "D:Email BackupsTest", $olMSG, 3)
_OL_ItemSave($oOutlook, ^ ERROR
 
Updated code:
For $b = 1 to UBound($aItems) - 1
        If UBound($aItems) > 1 Then
            If Not FileExists("D:\Email Backups\Test" & $tempfolder) Then
                DirCreate("D:\Email Backups\Test" & $tempfolder)
            EndIf
            MsgBox(0, "", $b)
            _OL_ItemSave($oOutlook, $aItems[$b], Default, "D:\Email Backups\Test\", $olMSG, 3)
            If @error <> 0 Then Exit MsgBox(16, "OutlookEX UDF: _OL_ItemSave Example Script", "Error saving mail item to C:\temp\Outlook-UDF-Test\Dir1\. @error = " & @error & ", @extended = " & @extended)
        EndIf
Next

Array Display of $aItems:

3
000000004DC7295BEE3BFF4CBAD193F22613E2F3070034AD76187591974DBF6C4F76951C873A01000A0000000000D9539C2261A6BB45B9DAB62C7081B3C101008B0000000000
000000004DC7295BEE3BFF4CBAD193F22613E2F3070034AD76187591974DBF6C4F76951C873A01000A0000000000D9539C2261A6BB45B9DAB62C7081B3C10100D50000000000
000000004DC7295BEE3BFF4CBAD193F22613E2F3070034AD76187591974DBF6C4F76951C873A01000A0000000000D9539C2261A6BB45B9DAB62C7081B3C10100D60000000000
Edited by crashnburn
Link to comment
Share on other sites

I can't test at the moment but I think it is still a 2D array with just a single column. Can you insert the second index again and try again?

Edited by water

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

:)

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

I am having problems getting attached images to embed in the email body of Outlook Web App users.

This works:

_OL_ItemModify($oOApp, $oReply, Default, 'HTMLBody=<img src="http://www.google.com/intl/en_ALL/images/logos/images_logo_lg.gif" />')

This does not work:

$oReply = _OL_ItemAttachmentAdd($oOApp, $oReply, Default, @ScriptDir & "\PNG.png")
_OL_ItemModify($oOApp, $oReply, Default, 'HTMLBody=<img src="cid:PNG.png" />)

It would be nice if I could find a way to show the attached image in the email however I am also open to any reliable way to upload about 100 images a day and then embed them using the first example.

Thanks

Link to comment
Share on other sites

Does example 4 of _OL_ItemCreate.au3 work for you?

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

Did you try to display the mail in an Outlook client on a PC?

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

Yes it displays in the Outlook client on my PC. After a lot of googling and reading it looks like this is a common issue with OWA. However I have found a workaround that will work for me.

I can use _OL_MaiLSignatureCreate() to add a new image for each person I email. It will then show the image in OWA. The only question I have now is how do I resize the image set by $oSelection.InlineShapes.AddPicture()?

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

×
×
  • Create New...