Last modified: July 23, 2011

Applies to: Outlook

Copies a profile.

  LPSTR lpszOldProfileName,
  LPSTR lpszOldPassword,
  LPSTR lpszNewProfileName,
  ULONG_PTR ulUIParam,
  ULONG ulFlags


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


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


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


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


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


Displays a dialog box that prompts the user for the correct password of the profile to copy. If this flag is not set, no dialog box is displayed.


The profile was successfully copied.


The new profile name is the same as that of an existing profile.


The password for the profile to copy is incorrect, and a dialog box could not be displayed to the user to request the correct password because MAPI_DIALOG was not set in the ulFlags parameter.


The specified profile does not exist.


The user canceled the operation, typically by clicking the Cancel button in a dialog box.

The IProfAdmin::CopyProfile method makes a copy of the profile pointed to by lpszOldProfileName, giving it the name pointed to by lpszNewProfileName. Copying a profile leaves the copy with the same password as the original.

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

Profile passwords are not supported on all operating systems. On operating systems that do not support profile passwords, lpszOldPassword can be NULL or a pointer to a zero-length string.

If lpszOldPassword is set to NULL, the profile to be copied requires a password, and the MAPI_DIALOG flag is set; a dialog box that prompts the user to provide the password is displayed. If a password is required, but lpszOldPassword is set to NULL and the MAPI_DIALOG flag is not set, CopyProfile returns MAPI_E_LOGON_FAILED.