IProfAdmin::CopyProfile

The IProfAdmin::CopyProfile method copies a profile.

Quick Info

See IProfAdmin : IUnknown.

HRESULT CopyProfile(
  LPTSTR lpszOldProfileName,   
  LPTSTR lpszOldPassword,   
  LPTSTR lpszNewProfileName,   
  ULONG ulUIParam,          
  ULONG ulFlags             
);
 

Parameters

lpszOldProfileName
[in] Pointer to the name of the profile to copy.
lpszOldPassword
[in] Pointer to the password of the profile to copy.
lpszNewProfileName
[in] Pointer to the new name of the copied profile.
ulUIParam
[in] Handle of the parent window for any dialog boxes or windows this method displays.
ulFlags
[in] Bitmask of flags that controls how the profile is copied. The following flags can be set:
MAPI_DIALOG
Allows the display of a dialog box prompting the user for the correct password of the profile to copy. If this flag is not set, no dialog box is displayed.
MAPI_UNICODE
The profile names and password are in Unicode format. If the MAPI_UNICODE flag is not set, these strings are in ANSI format.

Return Values

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 requesting 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:

Profile passwords are not supported on all operating system platforms; on platforms that do not support profile passwords, lpszOldPassword can be NULL or a pointer to a zero-length string. Currently, Windows NT Server and Windows 95 do not support passwords; Windows version 3.1 does.

If lpszOldPassword is set to NULL, the profile to be copied requires a password, and the MAPI_DIALOG flag is set; a dialog box prompting 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.