Frage

Getting default inbox works like the following:

_outlookNameSpace = this.Application.GetNamespace("MAPI");
_inbox = _outlookNameSpace.GetDefaultFolder(Microsoft.Office.Interop.Outlook.OlDefaultFolders.olFolderInbox);

Now on the same lines, how do get the inbox for the other exchange account say "abc@corp.com" ?

Thanks in advance.

War es hilfreich?

Lösung

Assuming the second mailbox is already in the profile, you need to find the appropriate account in the Namespace.Stores collection and call Store.GetDefaultFolder.

Otherwise you can call Namespace.GetSharedDefaultFolder.

Andere Tipps

I have a similar situation, where the 2nd account is identified by its .DisplayName property, which can be set in Account Setup. To find the Account, use:

var account = Globals.Addin.Application.GetNamespace("MAPI")
                .Accounts.Cast<Account>()
                .FirstOrDefault(a => a.DisplayName == "TargetDisplayName");

Then use Account.DeliveryStore to get access to the store and find the folder. .GetDefaultFolder gives you the folder:

DraftsFolder = (Folder) account.DeliveryStore.GetDefaultFolder(OlDefaultFolders.olFolderDrafts);
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top