# OutlookEX UDF (Question, not error)

## 12 posts in this topic

Howdy!

I've been reading through the OutLookEX documentation and examples for the past two days ( VERY well documented, very clear! )

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

##### Share on other sites

Should I repost this in this forum thread?

##### Share on other sites

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 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
Tutorials:

##### Share on other sites

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

##### Share on other sites

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!

##### Share on other sites

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 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
Tutorials:

##### Share on other sites

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.

;List the folders