emily_bma
emily_bma

Reputation: 301

How to access shared mailbox's Contacts Address Book in Outlook programmatically

I have four mailboxes in my Outlook 2013 client at work, my personal ([email protected]) and the other three are shared mailboxes for projects/teams I am on, for example, ([email protected]), ([email protected]), etc.

I am using C# and can access the Contacts Address Book for my own mailbox just fine, but I would like to know how to access another mailbox's Contacts?

This works fine when accessing my own Contacts:

Outlook.MAPIFolder myContactsFolder = application.Session.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderContacts);

What is the equivalent for say mailbox ([email protected])? I do have the username and password for this account just in case you need it but I don't believe you need it since I am creating an AddIn that will be used during the user's active session.

Upvotes: 1

Views: 1244

Answers (2)

Dmitry Streblechenko
Dmitry Streblechenko

Reputation: 66215

Call Namespace.CreateRecipient and pass the returned Recipient object to the Namespace.GetSharedDefaultFolder function.

Upvotes: 3

Eugene Astafiev
Eugene Astafiev

Reputation: 49397

You can get a store specific default folder using the GetDefaultFolder method of the Store class. So, you can iterate over all stores in the profile and get store-specific folders. The Namespace class provides the Stores property which returns a Stores collection object that represents all the Store objects in the current profile.

See How to: Enumerate Folders on All Stores for more information.

Upvotes: 0

Related Questions