Get Mailbox

  • Thread starter Thread starter Craig Buchanan
  • Start date Start date
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
 
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.)
 
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
 
Back
Top