MCv Posted July 16, 2019 Share Posted July 16, 2019 Hi, I'm fairly new to AutoIt, so please forgive me for asking. I have already searched and found a similar topic ( but I can't seem to get it working. I can only connect to the default user/mailbox, but not other mailboxes. I have my.name@company.com and also access to a few generic support mailboxes in the company, xyz@company.com and bla@company.com. Accessing my.name@company.com works fine, but I need access to the inbox from the other mailboxes. The example au3 for FolderAccess gives an error when I try to use it with, for example, bla@company.com I have read the wiki https://www.autoitscript.com/wiki/OutlookEX_UDF_-_Folder_Item Does someone have a working code snippet for this particular problem? Many thanks. Link to comment Share on other sites More sharing options...
water Posted July 16, 2019 Share Posted July 16, 2019 Can you please post the code snippet where you access the folder? My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
MCv Posted July 16, 2019 Author Share Posted July 16, 2019 #include <OutlookEX.au3> Global $oOutlook = _OL_Open() $aFolder = _OL_FolderAccess($oOutlook, "bla@company.com") If @error <> 0 Then Exit MsgBox(16, "OutlookEX UDF: _OL_FolderAccess Example Script", "Error accessing the default contacts folder. @error = " & @error) $aFolder[1].Display MsgBox(64, "OutlookEX UDF: _OL_FolderAccess Example Script", "Default contacts folder successfully accessed and displayed.") _OL_Close($oOutlook) A very short version of your FolderAccess example code. This code gives error 4, if I use \\bla@company.com I get error 1. Link to comment Share on other sites More sharing options...
MCv Posted July 16, 2019 Author Share Posted July 16, 2019 Forgot to say that if I use "\\bla@company.com", $olFolderInbox) I get error 3. Link to comment Share on other sites More sharing options...
water Posted July 16, 2019 Share Posted July 16, 2019 (edited) Could you please try: _OL_FolderAccess($oOutlook, "\\bla@company.com\", $olFolderInbox) Edited July 18, 2019 by water Parameter 1 was missing - hence the error My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
MCv Posted July 16, 2019 Author Share Posted July 16, 2019 13 minutes ago, water said: Could you please try: _OL_FolderAccess("\\bla@company.com\", $olFolderInbox) That also gives error 4. I tried referencing the account by name instead of email address and that seems to do more. It opens up a search (for the correct account!), but not the Inbox / number of emails in the Inbox. Is OutlookEX compatible with Outlook 365? Link to comment Share on other sites More sharing options...
water Posted July 16, 2019 Share Posted July 16, 2019 3 hours ago, MCv said: Is OutlookEX compatible with Outlook 365? Only with the on premise version not the cloud based. Which one do you run? My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
MCv Posted July 16, 2019 Author Share Posted July 16, 2019 51 minutes ago, water said: Only with the on premise version not the cloud based. Which one do you run? How can I tell? I'm just an employee :) Link to comment Share on other sites More sharing options...
water Posted July 16, 2019 Share Posted July 16, 2019 I only use Office 2016. So I had a look at Google: https://www.howtogeek.com/354238/whats-the-latest-version-of-microsoft-office/ My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
MCv Posted July 17, 2019 Author Share Posted July 17, 2019 I have Outlook 365 ProPlus. I don't know what installation method the IT people have chosen though. Do you have a suggestion/improvement for the referencing by name and not getting the Inbox? Link to comment Share on other sites More sharing options...
water Posted July 17, 2019 Share Posted July 17, 2019 The OutlookEX UDF does only support local installations of Outlook. So I suggest to ask the IT people if there is a local installation. I had a look at your script and noticed that you do not check for errors after _OL_Open. If there is no local Office installation then you should get an error raised by _OL_Open. Can you please check? My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
MCv Posted July 17, 2019 Author Share Posted July 17, 2019 #include <OutlookEX.au3> Global $oOutlook = _OL_Open() If @error <> 0 Then Exit MsgBox(16, "OutlookEX UDF", "Error creating a connection to Outlook. @error = " & @error & ", @extended = " & @extended) $aFolder = _OL_FolderAccess("\\bla@company.com\", $olFolderInbox) If @error <> 0 Then Exit MsgBox(16, "OutlookEX UDF: _OL_FolderAccess Example Script", "Error accessing the default contacts folder. @error = " & @error) $aFolder[1].Display MsgBox(64, "OutlookEX UDF: _OL_FolderAccess Example Script", "Default contacts folder successfully accessed and displayed.") _OL_Close($oOutlook) Added the error check: no errors on _OL_Open, just the error on _OL_FolderAccess. So I guess it's a local installation. I have another AutoIt/OutlookEX script for the default account and that works fine. Link to comment Share on other sites More sharing options...
water Posted July 17, 2019 Share Posted July 17, 2019 Looks good so far. Seems we need to do additional tests. Will be back in a few hours. My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
MCv Posted July 17, 2019 Author Share Posted July 17, 2019 #include <OutlookEX.au3> Global $oOutlook = _OL_Open() If @error <> 0 Then Exit MsgBox(16, "OutlookEX UDF", "Error creating a connection to Outlook. @error = " & @error & ", @extended = " & @extended) $aFolder = _OL_FolderAccess($oOutlook, "ACCOUNT NAME") If @error <> 0 Then Exit MsgBox(16, "OutlookEX UDF: _OL_FolderAccess Example Script", "Error accessing the default contacts folder. @error = " & @error) $aFolder[1].Display MsgBox(64, "OutlookEX UDF: _OL_FolderAccess Example Script", "Default contacts folder successfully accessed and displayed.") _OL_Close($oOutlook) This is what my most successful version looks like. This opens an Outlook window that lets you search in the correct mailbox, but doesn't show the Inbox. Link to comment Share on other sites More sharing options...
MCv Posted July 17, 2019 Author Share Posted July 17, 2019 Btw, adding , $olFolderInbox) to _OL_FolderAccess in the above example doersn't make any difference. Link to comment Share on other sites More sharing options...
Nine Posted July 17, 2019 Share Posted July 17, 2019 (edited) Well, I opened the code of _OL_FolderAccess, and I don't believe it is possible to use "\\bla@company.com". Seems to me that you would need to use "\\FisrtName Name" format. However I tried using it but it doesn't work either for me. (Outlook 2003 here). @water The first line of code of the function is highly suspicious. If $sFolder = "" = Default Then $sFolder = "" And the problem seems to come from those 3 lines Local $oDummy = $oNamespace.CreateRecipient("=" & $aFolders[1]) ; Create Recipient. "=" sets resolve to strict $oDummy.Resolve ; Resolve If Not $oDummy.Resolved Then Return SetError(2, 0, "") I tried some modifs to make it work, unsuccessfully Edit - Reading MSDN : RecipientName Required String The name of the recipient; it can be a string representing the display name, the alias, or the full SMTP email address of the recipient. So it should also work with "\\bla@company.com" Edited July 17, 2019 by Nine “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
MCv Posted July 17, 2019 Author Share Posted July 17, 2019 1 hour ago, Nine said: Edit - Reading MSDN : RecipientName Required String The name of the recipient; it can be a string representing the display name, the alias, or the full SMTP email address of the recipient. So it should also work with "\\bla@company.com" You are referring to https://docs.microsoft.com/en-us/office/vba/api/outlook.recipients ? Link to comment Share on other sites More sharing options...
Nine Posted July 17, 2019 Share Posted July 17, 2019 https://docs.microsoft.com/en-us/office/vba/api/outlook.namespace.createrecipient “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
water Posted July 17, 2019 Share Posted July 17, 2019 4 hours ago, Nine said: If $sFolder = "" = Default Then $sFolder = "" That's correct, it's a bug! My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
water Posted July 17, 2019 Share Posted July 17, 2019 Can you please post a screenshot of Outlook after you have manually connected to the other mailbox (all private info can be greyed out)? My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now