MAPI and Exchange 2013 Public Folders

Prior to Exchange 2013, when Outlook’s emsmdb32 provider would log on to the server, it would get various bits of information back from the server, including information needed to connect to the Public Folder store. The provider would use this information to add the Public Folder store to the profile. This work involved pumping messages and this is where the workaround given here was involved:

https://blogs.msdn.com/b/stephen_griffin/archive/2007/05/30/outlook-2007-public-folders-mapi-and-you.aspx

With Exchange 2013, logon no longer returns any information related to Public Folders. Instead, the information needed to connect to Public Folders is handled through Autodiscover. When we do the initial AutoDiscover for profile creation, we get an entry back indicating that there is a Public Folder mailbox. Here’s what it looked like for my test mailbox:

 <PublicFolderInformation>
   <SmtpAddress>TestPFMailbox@tailspintoys.com</SmtpAddress>
 </PublicFolderInformation>

We see the name of the Public Folder mailbox is TestPFMailbox. Outlook uses this information to conduct another Autodiscover conversation to get information on the Public Folder mailbox. Essentially, we send a request that looks like this:

 <?xml version="1.0" encoding="utf-8"?>
 <Autodiscover xmlns="https://schemas.microsoft.com/exchange/autodiscover/outlook/requestschema/2006">
   <Request>
     <EMailAddress>TestPFMailbox@tailspintoys.com</EMailAddress>
     <AcceptableResponseSchema>https://schemas.microsoft.com/exchange/autodiscover/outlook/responseschema/2006a</AcceptableResponseSchema>
   </Request>
 </Autodiscover>

We get a response back with information on the PF mailbox. Outlook then uses this information to make a call to CreateProvider to actually add the Public Folder store to the profile. CreateProvider takes a set of MAPI properties, whose values were derived from the information in the Autodiscover response. The properties we pass to CreateProvider are all derived from the AutoDiscover response:

Property Source/Value Comment
PR_DISPLAY_NAME_W   Public Folders –%s”, where %s is the value of PR_PROFILE_USER_SMTP_EMAIL_ADDRESS_W. So, for my folder, it would be “Public Folders – sgriffin@tailspintoys.com
PR_PROFILE_USER PR_PROFILE_USER This is the value of PR_PROFILE_USER from the Exchange Profile Section
PR_PROFILE_ALTERNATE_STORE_TYPE "Public" Hardcoded value
PR_EMSMDB_SECTION_UID User’s emsmdbUID This is the GUID of the Exchange Profile Section
PR_PROFILE_SERVER Server from the EXCH node in the Autodiscover response Truncate this value at the first ‘.’ in the Server value. For instance, if Server is “1234…5678@tailspintoys.com”, this value would be “1234…5678@tailspintoys
PR_PROFILE_SERVER_DN ServerDN from the EXCH node in the Autodiscover response  
PR_PROFILE_SERVER_FQDN Server from the EXCH node in the Autodiscover response  
PR_PROFILE_USER_SMTP_EMAIL_ADDRESS_W SMTPAddress from the PublicFolderInformation node in the Autodiscover response  
PR_PROFILE_AUTH_PACKAGE Mapped from AuthPackage from the EXCH node in the Autodiscover response For instance, a value of kerb would translate to RPC_C_AUTHN_GSS_KERBEROS. Special cases include: Anonymous maps to 0x8000F001
PR_ROH_FLAGS ROHFLAGS_USE_ROH | ROHFLAGS_SSL_ONLY If ServerExclusiveConnect is on, include ROHFLAGS_HTTP_FIRST_ON_FAST | ROHFLAGS_HTTP_FIRST_ON_SLOW if CertPrincipalName is not none, include ROHFLAGS_MUTUAL_AUTH
PR_ROH_PROXY_SERVER_W Server from the EXPR  node in the Autodiscover response  
PR_ROH_PROXY_AUTH_SCHEME Mapped from AuthPackage from the EXPR node in the Autodiscover response For instance, a value of Basic would translate to ROHAUTH_BASIC
PR_ROH_PROXY_PRINCIPAL_NAME CertPrincipalName from the EXPR node in the Autodiscover response  

I’ve done a bit of hand waiving above, and I’ve likely missed a number of corner cases, but this should be enough for someone to get started. All of this work actually happens in Outlook.exe, so there is no way for external MAPI processes to trigger it (though it’s possible it might happen while using the Outlook Object Model).

 

For more information on the Autodiscover process, see [MS-OXDSCLI]: Autodiscover Publishing and Lookup Protocol. Enjoy!