The IMSAdminBase::CopyKey method copies or moves a key, including its subkeys and data, to a specified destination. The copied or moved key becomes a subkey of the destination key.
HRESULT CopyKey(
METADATA_HANDLE hMDSourceHandle, //metabase handle to the source key
LPCWSTR pszMDSourcePath, //path of the source, relative to
// hMDSourceHandle
METADATA_HANDLE hMDDestHandle, //metabase handle to the destination
LPCWSTR pszMDDestPath, //path of the destination, relative to
// hMDDestHandle
BOOL bMDOverwriteFlag, //whether to overwrite or merge data with
// an existing version of the key
BOOL bMDCopyFlag //whether to copy or move the key
);
Returns an HRESULT that contains one of the following values:
ERROR_ACCESS_DENIED | Access is denied. Either the open handle does not have read or write permission as needed, or the user does not have sufficient permissions to perform the operation. |
ERROR_DUP_NAME | A key of that name already exists in the metabase. |
ERROR_INVALID_PARAMETER | The parameter is incorrect. |
ERROR_NOT_ENOUGH_MEMORY | Not enough memory is available to process this command. |
ERROR_PATH_NOT_FOUND | The specified path was not found in the metabase. |
ERROR_SUCCESS | The method succeeded. |