<div class="content"><p>The CopyData method copies or moves data between nodes.</p><dl>
<dd>
<div><pre> HRESULT CopyData(
   [in] METADATA_HANDLE hMDSourceHandle,
   [unique, in, string] LPCWSTR pszMDSourcePath,
   [in] METADATA_HANDLE hMDDestHandle,
   [unique, in, string] LPCWSTR pszMDDestPath,
   [in] DWORD dwMDAttributes,
   [in] DWORD dwMDUserType,
   [in] DWORD dwMDDataType,
   [in] BOOL bMDCopyFlag
 );
</pre></div>
</dd></dl><p><b>hMDSourceHandle: </b>An unsigned 32-bit integer
value containing an open <a href="1243ba70-74ca-44f9-be0b-dfd6697010b4#gt_086b13f2-2715-4000-a16c-6acc3d59cc19" data-linktype="relative-path">metabase</a>
handle specifying the source node from which the data is to be copied or moved.</p><p><b>pszMDSourcePath: </b>A pointer to a Unicode string
that contains the path of the node with which the source data is associated,
relative to the path of the <i>hMDSourceHandle</i> parameter.</p><p><b>hMDDestHandle: </b>An unsigned 32-bit integer
value containing an open metabase handle specifying the destination node to
which the data is to be copied or moved.</p><p><b>pszMDDestPath: </b>A pointer to a Unicode string
that contains the path of the node for data to be copied to or moved to,
relative to the path of the <i>hMDDestHandle</i> parameter.</p><p><b>dwMDAttributes: </b>Flags used to filter the data,
as specified in the <a href="10608402-8619-4ea9-be90-d57f21393ce0" data-linktype="relative-path">METADATA_RECORD</a>
structure.</p><p><b>dwMDUserType: </b>An integer value specifying the
data to copy based on the user type. </p><dl>
<dd>
<table><thead>
  <tr>
   <th>
   <p>Value</p>
   </th>
   <th>
   <p>Meaning</p>
   </th>
  </tr>
 </thead><tbody><tr>
  <td>
  <p>ALL_METADATA</p>
  <p>0x00000000</p>
  </td>
  <td>
  <p>Specifies all data, regardless of user type.</p>
  </td>
 </tr><tr>
  <td>
  <p>ASP_MD_UT_APP</p>
  <p>0x00000065</p>
  </td>
  <td>
  <p>Specifies data specific to ASP application
  configuration.</p>
  </td>
 </tr><tr>
  <td>
  <p>IIS_MD_UT_FILE</p>
  <p>0x00000002</p>
  </td>
  <td>
  <p>Specifies data specific to a file, such as access
  permissions or logon methods.</p>
  </td>
 </tr><tr>
  <td>
  <p>IIS_MD_UT_SERVER</p>
  <p>0x00000001</p>
  </td>
  <td>
  <p>Specifies data specific to the <a href="1243ba70-74ca-44f9-be0b-dfd6697010b4#gt_434b0234-e970-4e8c-bdfa-e16a30d96703" data-linktype="relative-path">server</a>, such as ports in
  use and IP addresses.</p>
  </td>
 </tr><tr>
  <td>
  <p>IIS_MD_UT_WAM</p>
  <p>0x00000064</p>
  </td>
  <td>
  <p>Specifies data specific to WAM.</p>
  </td>
 </tr></tbody></table>
</dd></dl><p><b>dwMDDataType: </b>An integer value specifying a
data type. If this parameter is not set to ALL_METADATA, the data item will be
copied only if its data type matches the specified type.</p><dl>
<dd>
<table><thead>
  <tr>
   <th>
   <p>Value</p>
   </th>
   <th>
   <p>Meaning</p>
   </th>
  </tr>
 </thead><tbody><tr>
  <td>
  <p>ALL_METADATA</p>
  <p>0x00000000</p>
  </td>
  <td>
  <p>Specifies all data, regardless of type.</p>
  </td>
 </tr><tr>
  <td>
  <p>BINARY_METADATA</p>
  <p>0x00000003</p>
  </td>
  <td>
  <p>Specifies binary data in any form.</p>
  </td>
 </tr><tr>
  <td>
  <p>DWORD_METADATA</p>
  <p>0x00000001</p>
  </td>
  <td>
  <p>Specifies all <a href="../ms-dtyp/262627d8-3418-4627-9218-4ffe110850b2" data-linktype="relative-path">DWORD</a>
  (unsigned 32-bit integer) data.</p>
  </td>
 </tr><tr>
  <td>
  <p>EXPANDSZ_METADATA</p>
  <p>0x00000004</p>
  </td>
  <td>
  <p>Specifies all data consisting of a string that
  includes the terminating null character, which contains unexpanded
  environment variables.</p>
  </td>
 </tr><tr>
  <td>
  <p>MULTISZ_METADATA</p>
  <p>0x00000005</p>
  </td>
  <td>
  <p>Specifies all data represented as an array of strings,
  where each string contains two occurrences of the terminating null character.</p>
  </td>
 </tr><tr>
  <td>
  <p>STRING_METADATA</p>
  <p>0x00000002</p>
  </td>
  <td>
  <p>Specifies all data consisting of an ASCII string that
  includes the terminating null character.</p>
  </td>
 </tr></tbody></table>
</dd></dl><p><b>bMDCopyFlag: </b>A Boolean value that specifies
whether to copy or move the data. If this parameter is set to TRUE, the data is
copied. If it is FALSE, the data is moved.</p><p><b>Return Values: </b>A signed 32-bit value that
indicates return status. If the method returns a negative value, it failed. If
the 12-bit facility code (bits 16–27) is set to 0x007, the value contains a
Win32 error code in the lower 16 bits. Zero or positive values indicate
success, with the lower 16 bits in positive nonzero values containing warnings
or flags defined in the method implementation. For more information about Win32
error codes and <a href="../ms-dtyp/a9046ed2-bfb2-4d56-a719-2824afce59ac" data-linktype="relative-path">HRESULT</a>
values, see <a href="../ms-erref/1bc92ddf-b79e-413c-bbaa-99a5281a6c90" data-linktype="relative-path">[MS-ERREF]</a>.</p><dl>
<dd>
<table><thead>
  <tr>
   <th>
   <p>Return value/code</p>
   </th>
   <th>
   <p>Description</p>
   </th>
  </tr>
 </thead><tbody><tr>
  <td>
  <p>0x00000000</p>
  <p>S_OK</p>
  </td>
  <td>
  <p>The call was successful.</p>
  </td>
 </tr><tr>
  <td>
  <p>0x80070003</p>
  <p>ERROR_PATH_NOT_FOUND</p>
  </td>
  <td>
  <p>The system cannot find the path specified.</p>
  </td>
 </tr><tr>
  <td>
  <p>0x80070005</p>
  <p>E_ACCESSDENIED</p>
  </td>
  <td>
  <p>General access denied error.</p>
  </td>
 </tr><tr>
  <td>
  <p>0x80070006</p>
  <p>ERROR_INVALID_HANDLE</p>
  </td>
  <td>
  <p>The handle is invalid.</p>
  </td>
 </tr><tr>
  <td>
  <p>0x80070057</p>
  <p>E_INVALIDARG</p>
  </td>
  <td>
  <p>One or more arguments are invalid.</p>
  </td>
 </tr><tr>
  <td>
  <p>0x80070008</p>
  <p>ERROR_NOT_ENOUGH_MEMORY</p>
  </td>
  <td>
  <p>There is not enough memory to complete the operation.</p>
  </td>
 </tr></tbody></table>
</dd></dl><p>The <a href="1243ba70-74ca-44f9-be0b-dfd6697010b4#gt_e127848e-c66d-427d-b3aa-9f904fa4ada7" data-linktype="relative-path">opnum</a>
field value for this method is 15.</p><p>When processing this call, the server:</p><ul><li><p><span><span> 
</span></span>MUST check the <i>hMDSourceHandle</i> parameter. This handle is
valid if it is either the master root handle or a handle returned from a
previous <a href="a54be1d0-009a-493d-a53e-e2f7fbe87293" data-linktype="relative-path">OpenKey</a> call.
If the handle is invalid, return ERROR_INVALID_HANDLE error.</p>
</li><li><p><span><span> 
</span></span>MUST check the <i>hMDDestHandle</i> parameter. This handle is
valid if it is either the master root handle or a handle returned from a
previous OpenKey call. If the handle is invalid, return ERROR_INVALID_HANDLE
error.</p>
</li><li><p><span><span> 
</span></span>MUST check whether the destination handle was opened for write
access. If not, return E_ACCESSDENIED.</p>
</li><li><p><span><span> 
</span></span>MUST check whether the source relative path points to the
existing node. If not, return ERROR_PATH_NOT_FOUND.</p>
</li><li><p><span><span> 
</span></span>SHOULD check whether the destination relative path points to an
existing node. If not, return an error.<a id="Appendix_A_Target_11"></a><a aria-label="Product behavior note 11" href="88fd1df0-e63e-41ca-9bf3-bedcab57cd86#Appendix_A_11" data-linktype="relative-path">&lt;11&gt;</a></p>
</li><li><p><span><span> 
</span></span>MUST, if the <i>dwMDUserType</i> and the <i>dwMDDataType</i>
parameters are not equal to &#34;ALL_METADATA&#34;, use these parameters as
the data selection filter.</p>
</li><li><p><span><span> 
</span></span>MUST, if the <i>dwMDAttributes</i> parameter is defined, use this
parameter to get the data.</p>
</li><li><p><span><span> 
</span></span>MUST copy the selected data from the source node to the
destination node.</p>
</li><li><p><span><span> 
</span></span>MUST, if the <i>bMDCopyFlag</i> parameter is set to false, remove
the selected data from the source.</p>
</li></ul></div>