![]() |
|
|
| Become a Columnist Microsoft Exchange Site Microsoft Support SiteMSDN Exchange Site | ||
|
|
How to create MS Exchange Profiles in MS Outlook with MAPI
In
the last article you learned how to find a profile and to figure out if it
exists or not. Now I’ll tell you how to create and delete profiles. First,
if not already done, you should initialize MAPI and get a IProfAdmin interface. char
*pszProfileName; //Name of profile we want to create
(update) // Initialize MAPI. hr = MAPIInitialize(NULL); if (!FAILED(hr)) { //get
IProfAdmin interface hr =
MAPIAdminProfiles(0, &pProfAdmin); if (!FAILED(hr)) { // Create a new empty profile. hr =
pProfAdmin->CreateProfile(pszProfileName,
NULL, NULL, 0); if
(!FAILED(hr)) cout<<”Profile
”<<pszProfileName<<” created successfully”<<endl else cout<<”Profile
”<<pszProfileName<<” was not created”<<endl } } As usual don’t forget to release
interfaces and uninitialize MAPI. That’s
easy. Just call hr = pProfAdmin->DeleteProfile(pszProfileName, 0) instead of CreateProfile() to delete an existing profile. In
conclusion I should explain the fourth parameter in CreateProfile() function. If it’s zero then an
empty profile will be created. But if you put MAPI_DEFAULT_SERVICES there, your new created profile will
contain default services that were described in the file MAPISVC.INF file under [Default Services] section. Look at this file, we’ll
examine it in the next article where we’ll see how to create standard and user
defined services within a profile. |
|
|
|
Disclaimer: Your use of the information contained in these pages is at your sole risk. All information on these pages is provided "as is", without any warranty, whether express or implied, of its accuracy, completeness, fitness for a particular purpose, title or non-infringement, and none of the third-party products or information mentioned in the work are authored, recommended, supported or guaranteed by Pro Exchange. OutlookExchange.Com and Pro Exchange shall not be liable for any damages you may sustain by using this information, whether direct, indirect, special, incidental or consequential, even if it has been advised of the possibility of such damages.
© Copyright Pro Exchange, Inc., 2006