1
votes

my knowledge in c++ is very limited but i'm trying however to use this sample code to create mapi profile programmatically:

https://support.microsoft.com/en-us/kb/306962

I compiled the code but the sample features are not enough for me as it only adds: ProfileName, MailboxName and Server,

i want to add as well RPC Proxy Server(Connect over HTTP) with all the settings like this window:

Proxy Server image

As i see in the profiler.cpp code the MailboxName and Server are in this portion:

// First, server name
ZeroMemory(&rgval[1], sizeof(SPropValue) );
rgval[1].ulPropTag = PR_PROFILE_UNRESOLVED_SERVER;
rgval[1].Value.lpszA = szServer;

// Next, the mailbox name
ZeroMemory(&rgval[0], sizeof(SPropValue) );
rgval[0].ulPropTag = PR_PROFILE_UNRESOLVED_NAME; 
rgval[0].Value.lpszA = szMailbox;

and the tags/Properties are located in the EdkMdb.h file, so i tried to add this lines:

#define PR_PROFILE_RPC_PROXY_SERVER_FLAGS PROP_TAG( PT_LONG, pidProfileMin,0x2F)
#define PR_PROFILE_RPC_PROXY_SERVER_AUTH_PACKAGE (PT_LONG, pidProfileMin,0x1)
#define PR_PROFILE_RPC_PROXY_SERVER     PROP_TAG(PT_UNICODE, 0x6622001F)

Extend the rgval array

SPropValue      rgval[5];               // Property structure to hold values we want to set

then added this lines to the profiler.cpp

ZeroMemory(&rgval[2], sizeof(SPropValue));
rgval[2].ulPropTag = PR_PROFILE_RPC_PROXY_SERVER;
rgval[2].Value.lpszA = "mail.domain.com";

ZeroMemory(&rgval[3], sizeof(SPropValue));
rgval[3].ulPropTag = PR_PROFILE_RPC_PROXY_SERVER_FLAGS;
rgval[3].Value.ul = 0x1;

ZeroMemory(&rgval[4], sizeof(SPropValue));
rgval[4].ulPropTag = PR_PROFILE_RPC_PROXY_SERVER_AUTH_PACKAGE;
rgval[4].Value.ul = 0x2;

and change the 'Number of Properties to 5' here:

 if (FAILED(hRes = lpSvcAdmin->ConfigureMsgService(
        (LPMAPIUID)lpSvcRows->aRow->lpProps[iSvcUID].Value.bin.lpb, // Entry ID of service to configure
        NULL,                                                       // Handle to parent window
        0,                                                          // Flags
        5,                                                          // Number of properties we are setting
        rgval))) 

But it has no effect, the Proxy setting is not configured in the new profile,

What i'm doing wrong or missing?

I'm Appreciating any help, Thanks

1

1 Answers

0
votes

If you need to create an RPC-over-HTTP connection, there are quite a few properties you need to set. See http://blogs.msdn.com/b/dvespa/archive/2014/01/17/how-create-outlook-profile-office-365.aspx

Things are a lot easier in Outlook 2016 - you essentially only need to supply the SMTP address: see http://blogs.msdn.com/b/dvespa/archive/2015/10/29/how-to-configure-an-outlook-2016-profile-using-mfcmapi.aspx