<div class="content" name="InventoryNtmsLibrary" uuid="32bf946a-1fee-4a49-9faf-91bc36301ffe"><p>The InventoryNtmsLibrary method queues a request to perform
an <a href="8d988f06-72be-47cf-9e09-9060aa8ed897#gt_38cb8216-53ff-4936-a5c4-4d8d7672950a" data-linktype="relative-path">inventory</a> of an
online library.</p><dl>
<dd>
<div><pre> HRESULT InventoryNtmsLibrary(
   [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_STOP,
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. </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>Access to the object was denied.</td>
 </tr><tr>
  <td>0x80070057 ERROR_INVALID_PARAMETER</td>
  <td>A parameter is not valid.</td>
 </tr><tr>
  <td>0x800708CA ERROR_NOT_CONNECTED</td>
  <td>Unable to connect to the server.</td>
 </tr><tr>
  <td>0x800710D1 ERROR_LIBRARY_OFFLINE</td>
  <td>The library identifier refers to an offline library.</td>
 </tr><tr>
  <td>0x800710D5 ERROR_RESOURCE_DISABLED</td>
  <td>A resource required for this operation is disabled.</td>
 </tr><tr>
  <td>0x800710CD ERROR_INVALID_LIBRARY</td>
  <td>The library identifier is invalid.</td>
 </tr></tbody></table>
</dd></dl><p>Upon receiving this message, the server MUST verify that <b>lpLibraryId</b>
is not NULL. 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 get the
library selected from the database, check the access to the library, and verify
that the library is enabled and is online before making the call. If the client
does not have the required access rights, the server MUST return
ERROR_ACCESS_DENIED. If the library is disabled, the server MUST return ERROR_RESOURCE_DISABLED
(0x800710D5). If the library is offline, the server MUST return
ERROR_LIBRARY_OFFLINE (0x800710D1).</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_OMID</td>
  <td>A full on-media inventory is performed. Each side of each medium MUST be mounted into a drive.</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 (slots are classified).</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><tr>
  <td>NTMS_INVENTORY_STOP</td>
  <td>Stop the current inventory in the specified library.</td>
 </tr></tbody></table><p>The libraries that are not present MUST not be inventoried.</p><p>The InventoryNtmsLibrary method MUST mark all the slots that
currently contain a medium in the library for classification or identification.
The InventoryNtmsLibrary method returns when all the media is marked.</p><p>On completion of an asynchronous operation, notification
will be sent with the identifier lpLibraryId.</p></div>