How do I open a folder in another users mailbox?

H

Higgsy

Hi
I have to work with another user's Mailbox so I have this user's
Mailbox in my Outlook.

His Mailbox was added into my Outlook by the usual Tools/email
accounts/view or change existing email accounts/more
settings/advanced/"open these additional mailboxes"

So now I can see both my folders and his folders.

In VBA I'm trying to open a sub- folder of my Mailbox, but the
following code traverses this persons mailbox and not mine. It appears
that the ofRootFolder has been set to his mailbox and not mine

Public Sub zzz()
Dim onMAPI As NameSpace
Dim ofRootFolder As Folders
Dim ofFirstFolder As MAPIFolder

Set onMAPI = Application.GetNamespace("MAPI")
Set ofRootFolder = onMAPI.Folders
Set ofFirstFolder = ofRootFolder.GetFirst

MsgBox (ofFirstFolder.Name)
End Sub

How can I tell the code to traverse my Mailbox and not his?

thanks
Dave
 
S

Sue Mosher [MVP-Outlook]

Namespace.Folders is a collection of all the top-level folders visible in the folder hierarchy, including your own mailbox, the Public Folders hierarchy, and any other mailboxes and .pst files. If you iterate that collection and check the name of each MAPIFolder in the iteration, you should soon locate the mailbox you're interested in.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
H

Higgsy

Sue said:
Namespace.Folders is a collection of all the top-level folders visible in the folder hierarchy, including your own mailbox, the Public Folders hierarchy, and any other mailboxes and .pst files. If you iterate that collection and check the name of each MAPIFolder in the iteration, you should soon locate the mailbox you're interested in.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers

Sue,
Thanks very much - it's working just as you said
very gateful
regards
|Dave
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top