<div class="content" name="Import" uuid="3af12dea-5045-45b5-a529-e819d5c2c263"><p>The Import method imports <a href="1243ba70-74ca-44f9-be0b-dfd6697010b4#gt_086b13f2-2715-4000-a16c-6acc3d59cc19" data-linktype="relative-path">metabase</a> data from an
exported file into the metabase.</p><dl>
<dd>
<div><pre> HRESULT Import(
   [unique, in, string] LPCWSTR pszPasswd,
   [unique, in, string] LPCWSTR pszFileName,
   [unique, in, string] LPCWSTR pszSourcePath,
   [unique, in, string] LPCWSTR pszDestPath,
   [in] DWORD dwMDFlags
 );
</pre></div>
</dd></dl><p><b>pszPasswd: </b>A pointer to a Unicode string
containing the password that will be used to decrypt the secure properties of
the metabase data being imported.</p><p><b>pszFileName: </b>A pointer to a Unicode string
containing the name of the file, including directory path, to import settings
from. This file will have been created using the <a href="61afee7a-a004-47de-a264-f8e39998b566" data-linktype="relative-path">Export</a> function.</p><p><b>pszSourcePath: </b>A pointer to a Unicode string
containing the path to the metabase node being imported from the file specified
in <i>pszFileName</i>.</p><p><b>pszDestPath: </b>A pointer to a Unicode string
containing the path to the metabase node into which the file data will be
imported.</p><p><b>dwMDFlags: </b>A set of bit flags specifying the
import operation to be performed. It can be zero or one or more of the
following values.</p><dl>
<dd>
<table><thead>
  <tr>
   <th>
   <p>Value</p>
   </th>
   <th>
   <p>Meaning</p>
   </th>
  </tr>
 </thead><tbody><tr>
  <td>MD_IMPORT_INHERITED 0x00000001</td>
  <td>Inherited settings that were exported using the MD_EXPORT_INHERITED flag will be imported.</td>
 </tr><tr>
  <td>MD_IMPORT_NODE_ONLY 0x00000002</td>
  <td>Child nodes will not be imported.</td>
 </tr><tr>
  <td>MD_IMPORT_MERGE 0x00000004</td>
  <td>Imported settings will be merged with any matching existing node settings. When a value for a setting is present in the data file and also in the current metabase, the data file setting will overwrite the existing metabase setting. If this flag is not set and there is a current node in the metabase that conflicts with the node being imported, the imported node will replace the existing node. All settings from the existing node will be lost regardless of whether the imported node contains the setting or not.</td>
 </tr></tbody></table>
</dd></dl><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>0x00000000 S_OK</td>
  <td>The call was successful.</td>
 </tr><tr>
  <td>0x80070003 ERROR_PATH_NOT_FOUND</td>
  <td>The system cannot find the file specified.</td>
 </tr></tbody></table>
</dd></dl><p><b>Exceptions Thrown:</b> No exceptions are thrown
beyond those thrown by the underlying <a href="1243ba70-74ca-44f9-be0b-dfd6697010b4#gt_8a7f6700-8311-45bc-af10-82e10accd331" data-linktype="relative-path">RPC</a> protocol <a href="../ms-rpce/290c38b1-92fe-4229-91e6-4fc376610c15" data-linktype="relative-path">[MS-RPCE]</a>.</p><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 37. </p><p>When processing this call, the server MUST do the following:</p><ul><li><p><span><span> 
</span></span>The file specified by the <i>pszFileName</i> parameter MUST exist
and be local to the server; otherwise the server MUST return
ERROR_FILE_NOT_FOUND.</p>
</li><li><p><span><span> 
</span></span>The server MUST decrypt data with the password the client has
provided. </p>
</li><li><p><span><span> 
</span></span>The source path MUST exist in the exported data; otherwise the
server MUST return ERROR_PATH_NOT_FOUND.</p>
</li><li><p><span><span> 
</span></span>If the destination path exists on the server, the server SHOULD
replace it and all settings on it with the data from the data file unless the
client has passed the MD_IMPORT_MERGE flag.<a id="Appendix_A_Target_24"></a><a aria-label="Product behavior note 24" href="88fd1df0-e63e-41ca-9bf3-bedcab57cd86#Appendix_A_24" data-linktype="relative-path">&lt;24&gt;</a></p>
</li><li><p><span><span> 
</span></span>If the client has passed the MD_IMPORT_MERGE flag and the
destination path exists on the server, the server will overwrite any existing
settings with data from the data file, but will keep any settings that are not
present in the data file.</p>
</li><li><p><span><span> 
</span></span>If the MD_IMPORT_INHERITED flag is passed, the server MUST
include inherited properties from the data file when importing the data to the
server.</p>
</li><li><p><span><span> 
</span></span>If the MD_IMPORT_NODE_ONLY flag is passed, the server MUST import
only the specified node and its settings. Child nodes MUST NOT be included.</p>
</li></ul></div>