IProfAdmin::CopyProfile
This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This page may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
Copies a profile.
HRESULTCopyProfile(
LPTSTR lpszOldProfileName,
LPTSTR lpszOldPassword,
LPTSTR 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_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.
- MAPI_DIALOG
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_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.