IProfAdmin::CreateProfile

Applies to: Outlook 2013 | Outlook 2016

Creates a new profile.

HRESULT CreateProfile(
  LPSTR lpszProfileName,
  LPSTR lpszPassword,
  ULONG_PTR ulUIParam,
  ULONG ulFlags
);

Parameters

lpszProfileName

[in] A pointer to the name of the new profile.

lpszPassword

[in] A pointer to the password of the new profile.

ulUIParam

[in] A handle to the parent window of any dialog boxes or windows that this method displays.

ulFlags

[in] A bitmask of flags that controls how the profile is created. The following flags can be set:

MAPI_DEFAULT_SERVICES

MAPI should populate the new profile with the message services that are included in the [Default Services] section of the Mapisvc.inf file.

MAPI_DIALOG

The configuration property sheets of each of the providers in the message services to be added can be displayed.

Return value

S_OK

The new profile was created.

MAPI_E_NO_ACCESS

The specified new profile already exists.

Remarks

The IProfAdmin::CreateProfile method creates a new profile.

Notes to callers

You can call CreateProfile at application installation time or at any time during a session. When this method is called at installation time, many of the configuration settings come from the Mapisvc.inf configuration file. When this method is called during an active session, the settings come from the user who is prompted through a series of property sheets.

If the MAPI_DEFAULT_SERVICES flag is set in the ulFlags parameter, CreateProfile calls the message service entry point function for each message service in the [Default Services] section in the Mapisvc.inf file. Each message service entry point function is called with the ulContext parameter set to MSG_SERVICE_CREATE.

If both the MAPI_DIALOG and MAPI_DEFAULT_SERVICES flags are set, the values in the ulUIParam and ulFlags parameters are also passed to the message service entry point function. The message service entry point functions are called only after all available information from the Mapisvc.inf file has been added to the profile.

The name of the new profile and its password 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.

The lpszPassword parameter must be NULL or a pointer to a zero-length string.

See also

IMsgServiceAdmin::ConfigureMsgService

IMsgServiceAdmin::CreateMsgService

MSGSERVICEENTRY

IProfAdmin : IUnknown