VSTO Identify shared vs User mailbox

185 views Asked by At

In a VSTO add-in, I am trying to retrieve if the type of the mailbox is shared, user or resource. I read some interesting posts related to the question and try to look at the OlExchangeStoreType or GetConversation or MailboxType but did not succeed. I have seen the solution (3) from @DmitryStreblechenko but I would prefer to not use EWS if possible. It seems that the value that I am looking for is the msExchRecipientTypeDetails. Any help would be highly appreciated.

Relevant articles

  1. EWS Get mailbox type (user/resource/shared)

  2. MailItem.GetConversation() on shared mailbox

  3. In Outlook Addin, how do I determine if an email's Sender is a shared mailbox email address?

  4. https://www.codeproject.com/Questions/1088741/How-to-list-subfolders-in-inbox-folder-in-shared-e

  5. https://learn.microsoft.com/en-us/answers/questions/612248/in-outlook-addin-how-do-i-determine-that-an-email.html

2

There are 2 answers

2
Eugene Astafiev On

First of all, VSTO doesn't provide anything for that.

Second, the Outlook object model doesn't differentiate shared/local stores. So, you will not find any property or method for that in the OOM. The best what you could do is to use the Store.ExchangeStoreType property which returns a constant in the OlExchangeStoreType enumeration that indicates the type of an Exchange store.

It is up to you which way/workaround is to use form the list shared above.

4
Dmitry Streblechenko On

You don't need to use EWS - try to read Namespace.AutoDiscoverXml property to check if the shared mailbox and its type are there - you can see it in OutlookSpy (I am its author): click Namespace button, select AutoDiscoverXml property.

Look for the AlternativeMailbox\Type nodes - you can have "Archive", "Delegate", "TeamMailbox".