IProfAdmin::AdminServices
Applies to: Office 2010 | Outlook 2010 | Visual Studio
Provides access to a message service administration object for making changes to the message services in a profile.
HRESULT AdminServices(
LPSTR lpszProfileName,
LPSTR lpszPassword,
ULONG_PTR ulUIParam,
ULONG ulFlags,
LPSERVICEADMIN FAR * lppServiceAdmin
);
Parameters
lpszProfileName
[in] A pointer to the name of the profile to be modified. The lpszProfileName parameter must not be NULL.lpszPassword
[in] Always NULL.ulUIParam
[in] A handle of the parent window for any dialog boxes or windows that this method displays.ulFlags
[in] A bitmask of flags that controls the retrieval of the message service administration object. The following flags can be set:MAPI_DIALOG
Enables the display of a user interface.MAPI_UNICODE
The profile name is in Unicode format. If the MAPI_UNICODE flag is not set, the name is in ANSI format.
lppServiceAdmin
[out] A pointer to a pointer to a message service administration object.
Return Value
S_OK
The message service administration object was successfully returned.MAPI_E_LOGON_FAILED
The specified profile does not exist, or the password was wrong and a dialog box could not be displayed to the user to request the correct password because MAPI_DIALOG was not set in ulFlags.MAPI_E_USER_CANCEL
The user canceled the operation, typically by clicking the Cancel button in a dialog box.
Remarks
The IProfAdmin::AdminServices method provides access to a message service administration object for making configuration changes to the message services in a profile.
The lpszPassword parameter must be NULL or a pointer to a zero-length string.
Notes to Callers
Although you can retrieve an IMsgServiceAdmin pointer by calling either this method or IMAPISession::AdminServices, call IProfAdmin::AdminServices if you have strictly a configuration client and offer no messaging features. IProfAdmin::AdminServices does not create a session object and does not load any service providers, which enhances performance.
You cannot use IProfAdmin::AdminServices to create a profile. Therefore, you must specify an existing valid profile in lpszProfileName. If the specified profile does not exist, IProfAdmin::AdminServices returns MAPI_E_LOGON_FAILED.
The name of the profile can be up to 64 characters in length and can include the following characters:
All alphanumeric characters, including accent characters and the underscore character.
Embedded spaces, but not leading or trailing spaces.
MFCMAPI Reference
For MFCMAPI sample code, see the following table.
File |
Function |
Comment |
---|---|---|
MAPIProfileFunctions.cpp |
HrAddServiceToProfile |
MFCMAPI uses the IProfAdmin::AdminServices method to open a message service administration object for the selected profile to add services. |