active-directoryexchange-serverpublic-foldersexchange-server-2013

Is mailbox a PublicFolder


I have next issue: i have edb file(Exchange Server 2013), and i can get mailbox guids from it. One of mailbox is PublicFolder mailbox. It's impossible to find out if mailbox is PF, or just simple user's mailbox. I already have functionality to get all information of mailbox by it's guid from AD.

string filter = @"(&(objectClass=user)(msExchMailboxGuid=" + ESWUtils.GetADGuidString(guid) + "))";
search.Filter = filter;

search.SearchScope = SearchScope.Subtree;
search.PropertiesToLoad.Add("mail");
search.PropertiesToLoad.Add("displayname");
search.PropertiesToLoad.Add("samaccountname");
...

Is it possible to find out, that guid belongs to PF mailbox, from AD?


Solution

  • In Exchange 2013, Public Folders are moved into mailboxes and out of their own database. Looks like the easiest way is to look at the msExchRecipientTypeDetails attribute.

    search.Filter = "(msExchRecipientTypeDetails=68719476736)"
    

    Combine that with your other search criteria.

    Running a Get-Mailbox -PublicFolder on the mailbox will show the RecipientTypeDetails listed as PublicFolderMailbox. 68719476736 is the bitwise identifier that matches on the user attributes.