<div class="content" name="AccessNtmsLibraryDoor" uuid="a642d27e-0bd7-4798-9580-33bdabaee04b"><p>The AccessNtmsLibraryDoor method unlocks the <a href="8d988f06-72be-47cf-9e09-9060aa8ed897#gt_52b64896-966d-41bd-849a-36602125506b" data-linktype="relative-path">door</a> of an online library.</p><dl>
<dd>
<div><pre> HRESULT AccessNtmsLibraryDoor(
   [in] LPNTMS_GUID lpLibraryId,
   [in] DWORD dwAction
 );
</pre></div>
</dd></dl><p><b>lpLibraryId: </b>A pointer to the identifier of a
media library.</p><p><b>dwAction: </b>One of the NTMS_INVENTORY_NONE,
NTMS_INVENTORY_OMID, NTMS_INVENTORY_FAST, or NTMS_INVENTORY_DEFAULT values from
the <a href="7d94093c-93d1-47a7-b754-b213b0034ba6" data-linktype="relative-path">NtmsInventoryMethod</a>
enumeration, specifying the action to perform when the door is closed.</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>0x80070005 ERROR_ACCESS_DENIED</td>
  <td>NTMS_CONTROL_ACCESS to the library is denied; other security errors are possible but indicate a security subsystem error.</td>
 </tr><tr>
  <td>0x80070057 ERROR_INVALID_PARAMETER</td>
  <td>A parameter is not valid.</td>
 </tr><tr>
  <td>0x800700D1 ERROR_LIBRARY_OFFLINE</td>
  <td>A library identifier refers to an offline library.</td>
 </tr><tr>
  <td>0x800710D5 ERROR_RESOURCE_DISABLED</td>
  <td>The resource required for this operation is disabled.</td>
 </tr><tr>
  <td>0x800710DC ERROR_RESOURCE_NOT_PRESENT</td>
  <td>The resource that is required for this operation does not exist.</td>
 </tr><tr>
  <td>0x800710D9 ERROR_DATABASE_FAILURE</td>
  <td>The database query or update failed.</td>
 </tr></tbody></table>
</dd></dl><p>Upon receiving this message, the server MUST:</p><ul><li><p><span><span> 
</span></span>Verify that <i>lpLibraryId</i> is not NULL.</p>
</li><li><p><span><span> 
</span></span>Verify that <i>dwAction</i> is less than NTMS_INVENTORY_MAX.</p>
</li></ul><p>If parameter validation fails, the server MUST immediately
fail the operation and return ERROR_INVALID_PARAMETER (0x80070057).</p><p>If parameter validation succeeds, the server MUST check the
access to the library and verify that the library is enabled and online before
making the call. If the library is disabled, the server MUST return
ERROR_RESOUCE_DISABLED (0x800710D5). If the library is offline, the server MUST
return ERROR_LIBRARY_OFFLINE (0x800710D1).</p><p>If the library does not have a door, the server MUST return
ERROR_RESOURCE_NOT_PRESENT (0x800710DC).</p><p>The action taken by the server depends on the value of <i>dwAction</i>.
The following table lists all possible values for <i>dwAction</i>.</p><table><thead>
  <tr>
   <th>
   <p> Value </p>
   </th>
   <th>
   <p> Meaning </p>
   </th>
  </tr>
 </thead><tbody><tr>
  <td>NTMS_INVENTORY_NONE</td>
  <td>After the user closes the door, no inventory is performed. However, if a mount-label check fails, an inventory is performed.</td>
 </tr><tr>
  <td>NTMS_INVENTORY_OMID</td>
  <td>After the user closes the door, a full on-media inventory is performed.</td>
 </tr><tr>
  <td>NTMS_INVENTORY_FAST</td>
  <td>If the library has a bar code reader installed, this flag causes a bar code inventory to be performed. If the library does not have a bar code reader, this flag causes a differential inventory to be performed. The OMIDs are checked on each medium placed in an empty slot while the door is open.</td>
 </tr><tr>
  <td>NTMS_INVENTORY_DEFAULT</td>
  <td>Use the inventory method specified in the library object (for more information, see the description of the NTMS_LIBRARYINFORMATION structure).</td>
 </tr></tbody></table><p>The server programmatically unlocks the door of the specified
library. If the library is busy, the server MUST queue the request and return
success.</p><p>The failure or success of this method MUST NOT depend on the
type of library. Some libraries provide no means for the server to
programmatically lock and unlock their doors. The behavior of this method with
these libraries is identical to its behavior with libraries that the server can
unlock and lock.</p><p>On completion of an asynchronous operation, notification
will be sent with the identifier lpLibraryId.</p></div>