IProfAdmin::CopyProfile
Applies to: Outlook 2013 | Outlook 2016
Copies a profile.
HRESULTCopyProfile(
LPSTR lpszOldProfileName,
LPSTR lpszOldPassword,
LPSTR lpszNewProfileName,
ULONG_PTR ulUIParam,
ULONG ulFlags
);
Parameters
lpszOldProfileName
[in] A pointer to the name of the profile to copy.
lpszOldPassword
[in] A pointer to the password of the profile to copy.
lpszNewProfileName
[in] A pointer to the new name of the copied 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 copied. The following flags can be set:
MAPI_APP_PROFILE
Allows copying an "app" profile. This flag must be set if the existing profile is an "app" profile.
This flag may not be recognized or supported in all MAPI implementations.
MAPI_DIALOG
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.
Return value
S_OK
The profile was successfully copied.
MAPI_E_ACCESS_DENIED
The new profile name is the same as that of an existing profile.
MAPI_E_LOGON_FAILED
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.
MAPI_E_NO_ACCESS
The existing profile is an "app" profile, and the MAPI_APP_PROFILE flag was not set.
MAPI_E_NOT_FOUND
The specified profile does not exist.
MAPI_E_USER_CANCEL
The user canceled the operation, typically by clicking the Cancel button in a dialog box.
Remarks
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.
If the existing profile is an "app" profile, and the MAPI_APP_PROFILE flag is not set, CopyProfile returns MAPI_E_NO_ACCESS. If the existing profile is an "app" profile, and the MAPI_APP_PROFILE is set, the new profile will also be an "app" profile. If the existing profile is not an "app" profile, the new profile will not be an "app" profile regardless of the MAPI_APP_PROFILE flag.