Send mail from non default account which is not in the sessions accounts

后端 未结 1 1073
春和景丽
春和景丽 2020-12-19 22:48

I have created the following...

Outlook.MailItem oMail;
oMail = Inspector.CurrentItem;
Outlook.NameSpace session = oMa         


        
相关标签:
1条回答
  • 2020-12-19 23:39

    In Outlook 2007+, the code below will provide you with the delegate Exchange mailboxes a given user has access to (the "Open these additional mailboxes" listing). The key ingredient is the Session data Stores and the ExchangeStoreType.

    foreach (var store in Globals.ThisAddIn.Application.Session.Stores.Cast<Outlook.Store>().Where(c=>c.ExchangeStoreType == Outlook.OlExchangeStoreType.olExchangeMailbox)) 
                Trace.WriteLine(store.DisplayName);
    

    To send a message on behalf of another mailbox, you should use the property MailItem.SendOnBehalfName - since you technically only have one account (see this Outlook forums post).

    0 讨论(0)
提交回复
热议问题