Get Mailbox

C

Craig Buchanan

I am trying to determine the most effecient way to get a user's Mailbox.
Currently, I do this:

Dim OA As New Outlook.Application
Dim NS As Outlook.NameSpace
Set NS = OA.GetNamespace("MAPI")

'get contact folder
Dim CF As Outlook.MAPIFolder
Set CF = NS.GetDefaultFolder(olFolderContacts)

'get Mailbox
Dim MB As Outlook.MAPIFolder
Set MB = CF.Parent

Is there a better way? Thanks for the help.

Craig
 
N

neo [mvp outlook]

Not that I am aware of. (Only other way that I am aware of is to go thru the
namespace and reiterate the folders with some logic to determine the
"default" store.)
 
S

Sue Mosher [MVP-Outlook]

That code would get the mailbox *if* the user is using the mailbox as their default store. A quick check of the name of the MB folder should be a good indicator, but to know for certain whether a store is a mailbox or a .pst file, you need to use CDO 1.21.

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

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

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