none
8004010F when calling IProviderAdmin::CreateProvider to create public store profile in outlook MAPI Profile RRS feed

  • Question

  • Hi All,

    My environment is: Outlook 2013 (32bits) + Exchange Server 2013 SP1

    I'm calling CreateProfile to create an Profile in client, while this profile have no public folders provider, so I need to add a public store provider into it by calling IProviderAdmin::CreateProvider.

    I follow this blog to call auto discover for public email address & trying to add public store provider. Here are part of my code:

            auto result = serviceAdmin->AdminProviders(serviceUid, 0, &providerAdmin);
    	if (result != S_OK || providerAdmin == nullptr)
    	{
    		ReportMapiError(SEV_ERR, result, serviceAdmin, _T("Unable to create profile: ServiceAdmin.AdminProviders"));
    		goto error;
    	}
    
    	serverA = pfProfileInfo->Server;
    	serverDnA = pfProfileInfo->ServerDn;
    	emailDnA = profileInfo->UserDn;
    	subServerA = serverA.Mid(0, serverA.Find('.'));
    	providerName = (_T("Public Folders - ") + pfProfileInfo->PublicFolderSmtpAddress);
    
    	ZeroMemory(&rgval[0], sizeof(SPropValue));
    	rgval[0].ulPropTag = PR_DISPLAY_NAME_W;
    	rgval[0].Value.lpszW = (LPWSTR)(LPCWSTR)providerName;
    	ZeroMemory(&rgval[1], sizeof(SPropValue));
    	rgval[1].ulPropTag = PR_PROFILE_USER;
    	rgval[1].Value.lpszA = (LPSTR)(LPCSTR)emailDnA;
    	ZeroMemory(&rgval[2], sizeof(SPropValue));
    	rgval[2].ulPropTag = PR_PROFILE_SERVER;
    	rgval[2].Value.lpszA = (LPSTR)(LPCSTR)subServerA;
    	ZeroMemory(&rgval[3], sizeof(SPropValue));
    	rgval[3].ulPropTag = PR_PROFILE_SERVER_DN;
    	rgval[3].Value.lpszA = (LPSTR)(LPCSTR)serverDnA;
    
    	result = providerAdmin->CreateProvider(LPWSTR("Public Folders"),
    		4,
    		rgval,
    		0,
    		0,
    		&uid)

    I always get error code 8004010F, can anyone help on this, please? I googled it but get nothing...

    Thanks very much.

    Tuesday, November 17, 2015 7:01 AM

Answers

  • I resolved this issue by changing the provide name from: "Public Folders" to "EMSDelegate". So the code should be looks like this:

    result = providerAdmin->CreateProvider(LPWSTR("EMSDelegate"),
    		4,
    		rgval,
    		0,
    		0,
    		&uid)

    I tried EMSPUBLIC but did not work. So it's strange what the name of the public folder.

    Thanks for all of your help.

    BTW, I found it's difficult to ask a question in this forum. I'm not sure why? Because of the expression or something else? Most of the answers will suggest to work around rather than resolve the issue itself. 

    • Marked as answer by 络绎 Monday, November 23, 2015 7:23 AM
    Monday, November 23, 2015 7:23 AM

All replies

  • Exchange 2013 SP1 is very old, so I suggest that you start by updating the server to something more recent, then trying again. Exchange 2013 doesn't have public folders in the same way as previous versions of Exchange, which is probably why it isn't working for you.

    Any reason you aren't allowing Autodiscover to do the job? That is how Exchange 2013 is designed to work due to each user having an individual end point.

    Simon.


    Simon Butler, Exchange MVP
    Blog | Exchange Resources | In the UK? Hire Me.

    Tuesday, November 17, 2015 3:07 PM
  • Thanks Simon.

    1st, Exchange 2013 SP1 is one of our supported version - our customers have this version deployed in their environment of course we cannot force them to update.

    2nd, I don't understand what do you mean by "Any reason you aren't allowing Autodiscover to do the job"? I got the public folder info by Autodiscover, but can auto discover help me to add the public store provider to profile automatically?

    Current my steps are:

    1. Use an regular account & call auto discover then get the auto discover response(including the public smtp address under node PublicFolderInformation)

    2. Use the public smtp address to call autodiscover again to get autodiscover response for public folder

    3. Use the response info we got in 1st step to create a profile & added MSEMS service

    4. Use the response info we got in 2nd step to add the public store provider to the profile (We got error in this)

    For some particular reasons we have no other choice & have to create profile & got the public store provider in the profile.

    Any ideas about this, please? Thanks.


    • Edited by 络绎 Wednesday, November 18, 2015 7:12 AM
    Wednesday, November 18, 2015 1:11 AM
  • Any one has any ideas about this? Or is there any way to add the public store provider to outlook 2013 MAPI profile automatically?
    Friday, November 20, 2015 1:07 AM
  • That is what Autodiscover does. If you aren't seeing that in your client then something is wrong. You are trying to make things too complicated.

    While Exchange 2013 SP1 is still a supported version (only because it is a service pack) you should really be forcing your clients to update. They are only getting security updates being on that old version. If they want to move to Office365 then they must upgrade to the latest.

    Simon.


    Simon Butler, Exchange MVP
    Blog | Exchange Resources | In the UK? Hire Me.

    Friday, November 20, 2015 11:10 AM
  • I resolved this issue by changing the provide name from: "Public Folders" to "EMSDelegate". So the code should be looks like this:

    result = providerAdmin->CreateProvider(LPWSTR("EMSDelegate"),
    		4,
    		rgval,
    		0,
    		0,
    		&uid)

    I tried EMSPUBLIC but did not work. So it's strange what the name of the public folder.

    Thanks for all of your help.

    BTW, I found it's difficult to ask a question in this forum. I'm not sure why? Because of the expression or something else? Most of the answers will suggest to work around rather than resolve the issue itself. 

    • Marked as answer by 络绎 Monday, November 23, 2015 7:23 AM
    Monday, November 23, 2015 7:23 AM