The IMSAdminBase::CopyData method copies or moves data associated with the source key to the destination key. You can also specify whether the method copies the key's inherited data.
HRESULT CopyData(
METADATA_HANDLE hMDSourceHandle, //source metabase handle.
LPCWSTR pszMDSourcePath, //path to the source key relative to hMDSourceHandle.
METADATA_HANDLE hMDDestHandle, //destination metabase handle.
LPCWSTR pszMDDestPath, //path to the source key relative to hMDDestHandle.
DWORD dwMDAttributes, //attributes of the data.
DWORD dwMDUserType, //user type of the data.
DWORD dwMDDataType, //data type of the data.
BOOL bMDCopyFlag //flag that specifies whether to copy or move the data.
);
User type | Description |
ALL_METADATA | Copy or move all data, regardless of user type. |
ASP_MD_UT_APP | The entry contains information specific to ASP application configuration. |
IIS_MD_UT_FILE | Copy or move only data specific to a file, such as access permissions or logon methods. |
IIS_MD_UT_SERVER | Copy or move only data specific to the server, such as ports in use and IP addresses. |
IIS_MD_UT_WAM | The entry contains information specific to Web application management. |
Data type | Description |
ALL_METADATA | Copy or move all data, regardless of type. |
BINARY_METADATA | Binary data in any form. |
DWORD_METADATA | An unsigned 32-bit number. |
EXPANDSZ_METADATA | A null-terminated string that contains unexpanded environment variables, such as %PATH%. |
MULTISZ_METADATA | An array of null-terminated strings, terminated by two null characters. |
STRING_METADATA | A null-terminated ASCII string. |
Returns an HRESULT that contains one of the following values:
Value | Description |
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_INVALID_PARAMETER | The parameter is incorrect. |
ERROR_NOT_ENOUGH_MEMORY | There is not enough memory to complete the operation. |
ERROR_PATH_NOT_FOUND | The specified path is not found. |
ERROR_SUCCESS | The method succeeded. |
If inherited data is copied, (if dwMDAttributes specifies the METADATA_INHERIT flag) it is copied to the destination key, not to the corresponding parent keys.
The handle, METADATA_MASTER_ROOT_HANDLE, provides no guarantee against multiple thread access. If your application requires a constant data state, use a handle returned by IMSAdminBase::OpenKey.