How to configure an Outlook 2016 profile using MFCMAPI

The process for creating a Outlook profile in Outlook 2016 has changed. This article documents the simple steps to create one using MFCMAPI.  Note: For non-developers this is not the recommended way of creating profiles in Outlook 2016.  It is recommended that you use Outlook to create the profile as the logic for this is all built-in.  However, you can use these steps for troubleshooting purposes.

  1. Open up MFCMAPI, go to Profile > Show Profiles
  2. Click Actions > Create Profile

  1. Give the new profile a name and click OK.

  1. Select the new profile

  1. Type MSEMS for the service name
  2. Uncheck the box which says "Display Service UI"

  1. Click OK
  2. Double-Click the newly created profile.
  3. Single-Click the MSEMS service.
  4. Find the Exchange Profile section. This is a little difficult in Outlook’s MAPI since in 2010 and above we no longer have the global profile section. To find the Exchange Profile Section find the property PR_EMSMDB_SECTION_UID (0x3D150102) in the properties for the service. The value will be the GUID of the profile section persisted in binary form which will be used in the subsequent steps. You will need to remember this value.
  5. Double-Click the MSEMS service.
  6. Find the Exchange profile section by using the UID gathered from Step 10 and single-click it to select the row.
  7. Go to Property > Additional Properties

  1. Click Add and add the following properties PR_PROFILE_USER_SMTP_EMAIL_ADDRESS_W (0x6641001F) and PR_DISPLAY_NAME_W.

  1. Click OK
  2. Configure each property using the guidance below.
Value: SMTP Address of the user
Value: The display name of the user
  1. Find the property PR_STORE_PROVIDERS in the Exchange profile section.  This is the EMSMDB profile section.  Note the value of it.

  1. Find the corresponding profile section whose UID matches the value of PR_STORE_PROVIDERS.
  2. Repeat Steps 13 - 17 for that profile section too.

  1. Select Session > Logon and display store, and select the profile if it is not already selected.
  2. You may be prompted for credentials, but it should work successfully.

More Information

The display name on the Exchange profile section is not required, but I included it here for simplicity.

In Step 14, it is okay if the property name is not resolved to PR_PROFILE_USER_SMTP_EMAIL_ADDRESS_W.

Sample code can be found here that shows you how to do this programmatically.

If you're creating a profile for an or address please consult this blog post as well.


Comments (36)
  1. EinmalIM says:

    Hi Dave,

    with this and an earlier Outlook profile post of yours I was able to set up an Outlook MAPI profile to access Exchange 2016 mailboxes: primary mailbox of the profile and other mailboxes from MFCMAPI with MDB > Open other mailbox > from GAL (CreateStoreEntryIDFlags 9), if those mailboxes are on Exchange 2016 as well.

    But I am not able to open other mailboxes which live on Exchange 2010 in the same domain.

    If I create a profile for a primary mailbox on Exchange 2010 MFCMAPI can open others from 2010 but not from Exchange 2016.

    Using Outlook (2013 32 bit fully patched) with an autodiscover created profile, Outlook can open mailboxes on both Exchange servers.

    Can you describe how to set up one MAPI profile to open additional mailboxes with admin-flag on mixed Exchange Servers installed in coexistance? Exchange 2010 + 2013 + 2016 would be of interest.

    And: what needs to be done to add public folder access?

    Thank you


  2. OK, let me confirm I understand this:

    1. If you use this article and create a profile for Outlook 2016, you can open other mailboxes on Exchange 2016, but not Exchange 2010.

    2. Using Outlook 2013 and its in-built mechanism for creating profiles, you can connect to both Exchange 2010 and Exchange 2016 mailboxes.

    You neglected to tell me if you can use Outlook 2016's in-built mechanism to create the profile, if you can connect to both.

    Your question is: How do I create a profile that can connect to them all for Outlook 2016?

    My immediate guess on this one is that you either have Outlook Anywhere (ROH) and / or RPC over TCP/IP (the default) configured for the Exchange 2010 server. Either way, there is not enough in the profile to fully connect.  I _think_ that the new interface that I documented here (…/new-mapi-interface-ignore-home-server.aspx) may be appropriate, but I am not certain. I'll need to try this. In the meantime, you can try yourself by entering the correct Server Name and User DN in the 'Open other mailbox > From Gal' dialog and ticking the box marked 'Ignore home server (use Server DN).

    Additionally: How can I add a public message store to the profile.  I'll tackle that one in a separate comment to avoid confusion.

  3. Sven – I am not sure how to add a public folder store for 2016.  Have you tried what's documented here:…/10441743.aspx

  4. Oh wait, I forgot that the new interface that I documented is not in Outlook 2016 yet. So that won't work

  5. Bobby says:

    Thank you for the post! I found it very helpful.

    How do you add the public folders to the profile?

  6. Pranav says:

    Hi Dave. Thank you for the post. Iam in need of your assistance. I have an application which connects to target mailboxes to process mailbox folders. I have to manually create the exchange super user profile that has full access permission on set of mailboxes that my application wants to connect to. My application uses the MAPI CopyProfile to copy the exchange super user profile and configure the 2 unresolved profile parameters (PR_PROFILE_UNRESOLVED_SERVER, PR_PROFILE_UNRESOLVED_NAME) using the ConfigureMsgService call. The application uses this approach to open the target message store successfully all these years. We use the Outlook MAPI and not the exchange version for this. Now with the Outlook 2013, my application fails on the ConfigureMsgService call with MAPI_E_INVALID_PARAMETER. So I thought of trying the same approach that my application uses thru MFCMAPI i.e. CopyProfile=>FindMessageService=>ConfigureMsgService to configure the 2 properties that you have mentioned in this post i.e.  PR_DISPLAY_NAME_W and PR_PROFILE_USER_SMTP_EMAIL_ADDRESS_W. However the new profile (i.e. Copied out of exchange super user profile and Configured) opens the Exchange Super User mailbox instead of target mailbox that I specified using PR_PROFILE_USER_SMTP_EMAIL_ADDRESS_W, So I believe the new profile is NOT configured enough to connect to target message store. Could you please help me out on what other properties that I need to configure along with the ones you mentioned in this post for the CopyProfile approach. Thanks in advance for your time and help.

  7. Hi Pranav,

    The post above is for 2016 only.  It will not work for Outlook 2013.  Also, I have you consulted these articles:…/create-outlook-profile-exchange-2013.aspx…/how-create-outlook-profile-office-365.aspx  It would be also helpful to know if the target mailboxes are using MAPI over HTTP or RPC over HTTP.  Additionally, you may need this interface:…/new-mapi-interface-ignore-home-server.aspx

  8. Pranav says:

    Dave, Thanks for your time and response. Iam sorry it was a typo from my side. Iam on Outlook 2016 and have the Outlook 2016 Profile for exchange super user configured. My application uses the MAPI CopyProfile method to copy the exchange super user profile and configure the copied profile using ConfigureMsgService inorder to connect to target mailbox. This copied profile is temporary profile and will be deleted after processing the mailbox folders. My Application repeats the same steps to connect to different mailboxes. My application configures the following profile parameters after making copy of the exchange super user profile (PR_PROFILE_UNRESOLVED_SERVER, PR_PROFILE_UNRESOLVED_NAME). This approach of configuring the copied profile worked fine till Outlook 2013 and with Outlook 2016 the configuremsgservice fails to configure the aforementioned parameters and throws MAPI_E_INVALID_PARAMETER. That's when I came across your blog for Outlook 2016 and understood that we need to configure PR_DISPLAY_NAME_W and PR_PROFILE_USER_SMTP_EMAIL_ADDRESS_W. So I tried to configure these new profile parameters in the Copied Profile and then tried to open the message store. It opens the Exchange Super user's message store instead of message store that I configured using PR_PROFILE_USER_SMTP_EMAIL_ADDRESS_W. So with the CopyProfile approach, I believe PR_DISPLAY_NAME_W and PR_PROFILE_USER_SMTP_EMAIL_ADDRESS_W are not enough to fully configure the profile for target mailbox. So I thought of checking with you for any additional profile parameters that I might need to set outside of the ones you mentioned in this blog. This CopyProfile approach helped me in lot of ways, as I have to set just those 2 unresolved parameters (PR_PROFILE_UNRESOLVED_SERVER and PR_PROFILE_UNRESOLVED_NAME) in the Copied profile.

    On the MAPI Over HTTP Vs RPC Over HTTP, I have the following observations.

    I have two environments for my application

    Environment 1: Outlook 2016 pointing to Exchange 2013

    Environment 2: Outlook 2013 pointing to the same Exchange 2013

    My application runs without any issues in Environment 2 using the above mentioned CopyProfile approach i.e. Copying the existing exchange super profile and just setting the 2 unresolved parameters to connect the target mailbox.

    My application fails with MAPI_E_INVALID_PARAMETERS during the ConfigureMsgService call in Environment 1 using the CopyProfile approach.

    I have also tried to disable the MAPI Over HTTP in Outlook 2016 environment and tried to create a new profile for exchange super user and even then I end up seeing the MAPI_E_INVALID_PARAMETER while configuring the 2 unresolved parameters.

  9. Hi Pranav,  I don't think your existing method is going to work any longer.  We made some changes in how we calculate connection properties and now rely more on Autodiscover.  Therefore, the method outlined in this post are the recommended approach for creating profiles in Outlook 2016.

  10. Emily says:

    Hi Dave,

    Your sample code does not work in my env, after the profile creation using the sample code, the profile is not configured correctly, I can not logon to the mailbox correctly, please advise, thanks!


  11. Are you receiving an error code?  What is the error code and on what MAPI call does is the error code returned?

  12. Emily says:

    Hi Dave,

    I debugged the code, and found that the HrQueryAllRows method returned 0 rows.


  13. Did you change any of the strings in the sample from LPSTR to LPWSTR or pass the MAPI_UNICODE flag?  HrQueryRows wouldn't return 0 rows unless the message service wasn't found.  Try using MFCMAPI and confirm that the message service "MSEMS" gets created.

  14. Emily says:

    It works, thanks!

  15. So you have it working?  That's great to hear.

  16. Emily says:

    Hi Dave,

    Is there a property in the profile to let me know that what's the outlook version is when the profile was created?

  17. Yogendra Kumar says:

    Thank you for the post! I found it very helpful to connect exchange 2016 mailboxes using outlook 2016. But public folders are not.

    How do you add the public folders to the profile with outlook 2016 on exchange 2016 ?

  18. @Emily – There is not a profile property that indicates the client version.  However, since you are running on the client you can just determine that yourself.  For example, checking the file version on the msmapi32 or

    olmapi32 Dlls

    @Yogendar – Have you tried this?…/mapi-and-exchange-2013-public-folders

  19. Emily says:

    My problem is when I use a profile, I am not sure if the profile was created base on current outlook version, that's why I need to find a way to know the outlook client version for profile creation.

  20. I am not sure I understand.  Are you saying that you need to detect the client version before you attempt to create the profile because, based on the version, that will determine how you should create the profile?

  21. EinmalIM says:

    Hi Dave, sorry for the delay, had some other tasks to complete.

    Yes, both Outlook 2013 and Outlook 2016 create profiles which Outlook can use to connect to mailboxes sitting on other Exchange Server versions than the primary mailbox.

    My problem is that I would like to create a profile for Outlook MAPI (2010 to 2016 would be OK) from which I can connect to other mailboxes in the same Exchange organization with admin privileges. In MFCMAPI terms that would be Open Other User's Message Store with CreateStoreEntryID flags 0x9.

    But neither the profile from Outlook nor the profile created following your instructions can be used in MFCMAPI to open mailboxes in the same Exchange org on other Exchange Server versions.

    In our real app we do not need MFCMAPI but we use the same mechanism like MFCMAPI to open additional mailboxes with admin rights.

    Any idea how to set up a profile which works for mailbox access on different Exchange Servers?

    Thank you


  22. EinmalIM says:

    Hi Dave,

    any news on this?

    I can see this error in the RPC Client Access log of Exchange 2016 when trying to open an additional mailbox with MFCMAPI which is located on Exchange 2010:

    RopHandler: Logon: [RopExecutionException] Attempting to connect to an older (pre-E15) target mailbox version. Returning ecUnknownUser.. Error code = UnknownUser (0x000003EB)   at M.E.R.H.RopHandler.PrivateLogon

    How can I point the failing OpenMsgStore call [MAPI_E_FAILONEPROVIDER]  to the correct server?

    Thank you


  23. Sorry Seven I haven't had a chance to look into it.  If you need immediate assistance, I suggest creating a Microsoft support case.


  24. Also, ecUnknownUser means that the user doesn't exist on the current server. It's similar to the error ecWrongServer.  Somehow you are being routed to the wrong server for the target user.

  25. EinmalIM says:

    Yes, but the error text indicates that the server "knows" that the mailbox exists on another server (pre-E15 sound like pre-Ex2013, as 2013 is v15.0) and still is not able/willing to hand over to the right server.

    But how do I specify the right server to connect to? Entering the Exchange 2010 server name in the MFCMAPI dialog to open another users mailbox does not work. That edit control is always pre-filled with the mailbox-guid@domain value of the default mailbox of the profile.

  26. ecUknownUser means that the UserDN you specified isn't correct, (See details about the error message here:…/ee200938(v=exchg.80).aspx).  In practice, this is a way to tell Outlook (or the MAPI client) to perform Autodiscovery again on the target user to get the details correct.  What's most likely occurring here is that you are specifying the personalized server name for a pre-E15 user, which you shouldn't do.

    If you are connecting to a pre-E15 server you should specify the server name in the MFCMAPI dialog regardless of if it's pre-filled.  However, Outlook's MAPI will force you to the primary server for the profile regardless.  To tell Outlook not to do that you need to use the new interface I documented earlier (…/new-mapi-interface-ignore-home-server.aspx).  However, I don't believe this works on Outlook 2016 yet.

  27. EinmalIM says:

    I changed Outlook to 2013 with all Windows Updates. According to your ignore-home-server-blog that version should work as well, correct? But no matter which server value I enter (real server name, ServerDN oder MdbDN) the connection to an Exchange 2010 mailbox fails.

    I updated another test system with ex2010 and 2013 and added Exchange 2016. The mailboxes of 2016 and 2013 *can* be opened from one profile. So the pre-E15 error message was a good hint. Coexistence of 2016 and 2013 seems a bit easier than with 2010.

    I still fear that some Exchange 2010 customers will skip 2013 and will have coexistence of 2010 with 2016. So I still hope for a solution/work around for this scenario…

  28. Thanks for this great post. I have it working here but i wonder if it is possible to add additional mailboxes to using this method. I mean mailboxes for which the user has full rights. If i’m correct these are created automatically by AutoDiscovery but it takes a while and i want to offer a way to add other mailboxes to a new mail template centrally.

    If i check the profile which is created with the additional mailboxes i see they look the same as the primary mailbox.

    It has a 0x6641001F for the mail adres, a PR_DISPLAY_NAME_W, a PR_PROFILE_TYPE with value 2 instead of 1 and a 0x65D001F with the value Delegate. I remember before with the prf we could add it with the ADDMB and MSEMS.

  29. Mark says:

    I need some help. I see the sample code, but have been unable to create a project with it. Is there a sample project somewhere that I can reference to help me do this, or an article somewhere with an older version of the code?

    Any information you can provide would be appreciated.

    Thank you


    1. Hi Mark,

      What specifically are you having a problem with? Compile errors?


  30. Carl H says:

    Hi Dave. I’m using MFCMAPI to change the display name of the accounts in my Outlook profile (PR_DISPLAY_NAME). In MFCMAPI I can capture capital letters and it displays capital letters (eg. Bob @ Contoso), but when I open Outlook it only shows lower-case (eg. bob @ contoso). Any ideas how I can change this?

    1. Hmm, I wonder if Outlook is just making them all lowercase in the view. Let me do some research and reply if I can find the answer.

  31. AndreyKh says:

    How can I set the credentials automatically and avoid prompting for credentials at the 21th step?

    1. Microsoft doesn’t provide an API to add credentials in Outlook’s MAPI. MAPI can either use the desktop credentials or it will prompt for credentials. Depending on your scenario, you may be able to allow Office 365 to use your desktop credentials in a Single Sign On (SSO) authentication scenario. I’m not an expert in that, but I have seen some customers get it working.

  32. Akshata Raikar says:

    I created a profile following the above steps in MFC mapi. BUT I get an error saying “MAPI_E_INVALID_PARAMETER”

    1. On what step do you get the error?

Comments are closed.

Skip to main content