locked
Distinguishing between SharePoint Mailboxes and real Exchange Mailboxes RRS feed

  • Question

  • Hello all, I'll just give a brief objective of what I am trying to accomplish. 

    I have a form that displays to users a list of Contact Folders. 

    I loop through each store that I have (this includes SharePoint Mailboxes & SharePoint Site Mailboxes), and I also have normal Exchange Mailboxes along with a delegated Mailbox. 

    I want the list that I present to the user to NOT show the SharePoint Mailboxes. I don't want to show these mailboxes for 2 reasons. 

    1. It takes a long time to load these folders
    2. These contact folders don't actually appear inside of Outlook's "People" pane, what I ideally want is to only show the contact folders on my form that Outlook is able to present natively in the "People" pane. 

    I am stuck in this part, I can't concretely distinguish between the SharePoint mailboxes and the normal Exchange mailboxes because of the property 

    objfolder.Store.ExchangeStoreType 'The normal enumeration 

    For both of the SharePoint site mailboxes & the normal Exchange mailboxes, the resulting 

    ExchangeStoreType

    is 

    olExchangeMailBox

    So is there anyway I can actually distinguish between the two, so I can accurately filter out only the true contact folders? 

    Thanks in advance, also if you need any extra code I can post it here. 

    Tuesday, October 20, 2015 10:10 AM

Answers

  • 9EB4770074E411CE8C5E00AA004254E2 is the value pbExchangeProviderDelegateGuid, which is returned for a delegate Exchange mailbox. Normally when you have shared SharePoint folders the PR_SENDER_NAME indicates the provider with SharePoint folders. In this case it appears that the store is being treated as a normal delegated Exchange mailbox.

    In that case a fallback is to parse out the Exchange DN of the store owner from the StoreID value. If you look at the value of StoreID in OutlookSpy or MFCMAPI it should contain the store owner.

    Typical code to extract the maibox DN from StoreID would look something like this:

                string mailboxDN = "";

                    byte[] bytStoreEntryId = pa.GetProperty"http://schemas.microsoft.com/mapi/proptag/0x0FFB0102");

                    // Find start of mailboxDN
                    int i = 63;

                    while ((bytStoreEntryId[i] != 0) && (i < bytStoreEntryId.Length))
                        i++;
                    i++;

                    if (i != bytStoreEntryId.Length)
                    {
                        byte[] bytMailboxDN = new byte[bytStoreEntryId.Length - i + 1];

                        int j = 0;
                        while ((bytStoreEntryId[i] != 0) && (i < bytStoreEntryId.Length))
                        {
                            bytMailboxDN[j] = bytStoreEntryId[i];
                            i++;
                            j++;
                        }

                        mailboxDN = System.Text.ASCIIEncoding.ASCII.GetString(bytMailboxDN, 0, j);
                    }

    Another thing to look at with a low level MAPI viewer such as OutlookSpy or MFCMAPI would be any hidden items (associated content) in the store folders that have a MessageClass of

    "IPM.Sharing.Binding.In"


    Ken Slovak MVP - Outlook

    Friday, October 23, 2015 2:21 PM

All replies

  • Hello Rahul,

    Try to use any low-level property explorer tool such as MFCMAPI or OutlookSpy for comparing/viewing hidden properties (not available in OOM).

    You can add your own custom form using Windows API functions (subclassing Outlook windows). See Adjacent Windows In Outlook for more information. The sample code is available in C++: Creating Adjacent Windows In Outlook . Or just use Add-in Express which provides such forms out of the box for developers. Read more about Advanced Outlook view and form regions on their web site.

    Tuesday, October 20, 2015 11:27 AM
  • Take a look at the MAPI property PR_MDB_PROVIDER, which you can access using PropertyAccessor on the Folder or Store objects with the DASL property tag of "http://schemas.microsoft.com/mapi/proptag/0x34140102". See what result you get for a SharePoint folder as opposed to the result for an Exchange mailbox. For an Exchange mailbox you should get pbExchangeProviderPrimaryUserGuid ("5494A1C0297F101BA58708002B2A2517").

    You can also check PR_SENDER_NAME_W (http://schemas.microsoft.com/mapi/proptag/0x0C1A001F), with SharePoint you probably will see something like "{0006F0AD-0000-0000-C000-000000000046}"


    Ken Slovak MVP - Outlook


    Tuesday, October 20, 2015 2:53 PM
  • Hello Ken, thanks for your reply.

    I checked out both properties PR_MDB_PROVIDER & PR_SENDER_NAME. 

    PR_SENDER_NAME did not exist on any of my mailboxes so that can't be used an option. I tried accessing the property via the normal PropertyAccessor object and it threw an exception stating that the property did not exist. 

    PR_MDB_PROVIDER on the other hand wasn't able to correctly identify which one of the mailboxes was a SharePoint SiteMailbox. 

    For example, When I had an Exchange Mailbox opened the ExchangeStoreType value was olExchangeMailbox and PR_MDB_PROVIDER's result was 9EB4770074E411CE8C5E00AA004254E2. 

    When I ran the code against a SharePoint Site Mailbox the ExchangeStoreType was again olExchangeMailbox & the PR_MDB_PROVIDER result was 9EB4770074E411CE8C5E00AA004254E2. 

    So there still does not exist a clear distinction. 

    What I'm really trying to achieve now is just to identify a property that will indicate that a particular mailbox is a SharePoint Site mailbox. 

    Is this possible? 

    Thursday, October 22, 2015 9:22 PM
  • Try to play with any low-level property explorer such as MFCMAPI or OutlookSpy and compare Extended MAPI properties for each store. Thus, you can find the distrinct property(s).
    Friday, October 23, 2015 10:16 AM
  • 9EB4770074E411CE8C5E00AA004254E2 is the value pbExchangeProviderDelegateGuid, which is returned for a delegate Exchange mailbox. Normally when you have shared SharePoint folders the PR_SENDER_NAME indicates the provider with SharePoint folders. In this case it appears that the store is being treated as a normal delegated Exchange mailbox.

    In that case a fallback is to parse out the Exchange DN of the store owner from the StoreID value. If you look at the value of StoreID in OutlookSpy or MFCMAPI it should contain the store owner.

    Typical code to extract the maibox DN from StoreID would look something like this:

                string mailboxDN = "";

                    byte[] bytStoreEntryId = pa.GetProperty"http://schemas.microsoft.com/mapi/proptag/0x0FFB0102");

                    // Find start of mailboxDN
                    int i = 63;

                    while ((bytStoreEntryId[i] != 0) && (i < bytStoreEntryId.Length))
                        i++;
                    i++;

                    if (i != bytStoreEntryId.Length)
                    {
                        byte[] bytMailboxDN = new byte[bytStoreEntryId.Length - i + 1];

                        int j = 0;
                        while ((bytStoreEntryId[i] != 0) && (i < bytStoreEntryId.Length))
                        {
                            bytMailboxDN[j] = bytStoreEntryId[i];
                            i++;
                            j++;
                        }

                        mailboxDN = System.Text.ASCIIEncoding.ASCII.GetString(bytMailboxDN, 0, j);
                    }

    Another thing to look at with a low level MAPI viewer such as OutlookSpy or MFCMAPI would be any hidden items (associated content) in the store folders that have a MessageClass of

    "IPM.Sharing.Binding.In"


    Ken Slovak MVP - Outlook

    Friday, October 23, 2015 2:21 PM