Reizvoller Posted May 18, 2016 Share Posted May 18, 2016 Howdy! I've been reading through the OutLookEX documentation and examples for the past two days ( VERY well documented, very clear! ) https://www.autoitscript.com/wiki/OutlookEX_UDF_-_General But I've had trouble locating information on specifying what user to use. My outlook is linked to two email accounts and I can only manipulate the main account's stuff. A simple script I've been playing with is this ; Include Functions #include <OutlookEX.au3> ; Connect to Outlook Global $oOutlook = _OL_Open() If @error <> 0 Then Exit MsgBox(16, "Connect to Outlook", "Error connecting to Outlook. @error = " & @error & ", @extended = " & @extended) ;List the folders Global $aResult = _OL_FolderTree($oOutlook, "*") If @error <> 0 Then Exit MsgBox(16, "OutlookEX UDF: _OL_FolderTree Example Script", "Error accessing root folder. @error = " & @error) _ArrayDisplay($aResult, "OutlookEX UDF: _OL_FolderTree Example Script - All folders") It works like a charm but it only returns my main account's folders. I really hope I didn't overlook a wiki page or help file... Any assistance would be greatly appreciated! -Reiz Link to comment Share on other sites More sharing options...
Reizvoller Posted May 18, 2016 Author Share Posted May 18, 2016 Should I repost this in this forum thread? Link to comment Share on other sites More sharing options...
water Posted May 18, 2016 Share Posted May 18, 2016 No problem starting a new thread "*" is always resolved to the current user. Check the help file for _OL_FolderAccess and you will see how to access the folder of another user. Call _OL_FolderAccess and then pass the returned folder object to _OL_FolderTree. 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...
Reizvoller Posted May 20, 2016 Author Share Posted May 20, 2016 Hey there! Thank you for the guidance. What you have made is amazingly helpful ( or soon will be ) to my daily work life. I am going to dig into those docs and see what I come up with. Cheers! -Reiz Link to comment Share on other sites More sharing options...
Reizvoller Posted May 20, 2016 Author Share Posted May 20, 2016 Ah! I discovered the actual dilemma I am hitting! The area I am trying to access isn't a user account, it is just a "General Mailbox" meaning it has none of the usual functions of a normal user. Until 10 minutes ago I didn't know anything like this existed. At any rate if I can't specify a person/user , any ideas on how I can gain access to a set of folders that aren't exactly associated with a user account? When I right click on one of my own personal folders and click Properties , it gives me a location of "\\myemail@mydomain.com" When I right click on the mailbox's folder that I want to get into and click Properties it gives me a location of "\\thename" (( Not a blah@blue.com , just blah)) I used "thename" in the script and it returns with Error 1 which means to me that it can't access the specified root folder. ; Include Functions #include <OutlookEX.au3> ; Connect to Outlook Global $oOutlook = _OL_Open() If @error <> 0 Then Exit MsgBox(16, "Connect to Outlook", "Error connecting to Outlook. @error = " & @error & ", @extended = " & @extended) ;List the folders Global $aResult = _OL_FolderTree($oOutlook, "\\NAMEHERE") If @error <> 0 Then Exit MsgBox(16, "OutlookEX UDF: _OL_FolderTree Example Script", "Error accessing root folder. @error = " & @extended) _ArrayDisplay($aResult, "OutlookEX UDF: _OL_FolderTree Example Script - All folders") If there is information I am leaving out that would be useful to you just let me know and I will try to find it. Thank you very much for your time! Link to comment Share on other sites More sharing options...
water Posted May 20, 2016 Share Posted May 20, 2016 In the folder tree of Outlook at the root of the mailbox you want to access you see the name. Use this in _OL_FolderAccess. Example: 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...
Reizvoller Posted May 20, 2016 Author Share Posted May 20, 2016 Hey there, I really appreciate you spending time with me on this and helping me work through dillemma. I know you could be spending it doing ANYTHING else so I really do value you taking the time to respond to me. Thank you. I made the modifications as you suggested ; Include Functions #include <OutlookEX.au3> ; Connect to Outlook Global $oOutlook = _OL_Open() If @error <> 0 Then Exit MsgBox(16, "Connect to Outlook", "Error connecting to Outlook. @error = " & @error & ", @extended = " & @extended) Global $aFolder = _OL_FolderAccess($oOutlook, "\\NAME\Inbox", $olFolderInbox) if @error then MsgBox(0, "Error", "Error returned by _OL_FolderAccess: " & @error & "-" & @extended) ;List the folders Global $aResult = _OL_FolderTree($oOutlook, $aFolder) If @error <> 0 Then Exit MsgBox(16, "OutlookEX UDF: _OL_FolderTree Example Script", "Error accessing root folder. @error = " & @extended) _ArrayDisplay($aResult, "OutlookEX UDF: _OL_FolderTree Example Script - All folders") And I get back an "Error Accessing Root Folder , Error = 0" Again thank you very much for your time regarding this. Link to comment Share on other sites More sharing options...
water Posted May 20, 2016 Share Posted May 20, 2016 Unfortunately _OL_FolderAccess returns an array. So the statement should be: ;List the folders Global $aResult = _OL_FolderTree($oOutlook, $aFolder[1]) 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...
Reizvoller Posted May 20, 2016 Author Share Posted May 20, 2016 Well that returned a different error it seems! I should have known to call it as an array, thank you for reminding me. This is what I get when I try to run it now "C:\directorystuff\mail\OutlookEX.au3" (1259) : ==> The requested action with this object has failed.: $oFolder = $oNamespace.GetSharedDefaultFolder($oDummy, $iFolderType).Parent $oFolder = $oNamespace^ ERROR >Exit code: 1 Time: 2.633 Did I break your UDF? o.o I'm sorry!!! Link to comment Share on other sites More sharing options...
water Posted May 20, 2016 Share Posted May 20, 2016 (edited) You didn't break the UDF - that's not possible Could you please try: Global $aFolder = _OL_FolderAccess($oOutlook, "NAME\") Edited May 20, 2016 by water 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...
Reizvoller Posted May 20, 2016 Author Share Posted May 20, 2016 Howdy It worked! It worked it worked it worked! I literally jumped up in excitement and scared my fellow co-workers LOL Thank you very much! -Reiz Link to comment Share on other sites More sharing options...
water Posted May 20, 2016 Share Posted May 20, 2016 Now your fellow co-workers know how easy AutoIt is 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