InventoryNtmsLibrary function (ntmsapi.h)

[Removable Storage Manager is no longer available as of Windows 7 and Windows Server 2008 R2.]

The InventoryNtmsLibrary function queues an inventory of the specified library. If the library is busy, RSM queues InventoryNtmsLibrary and returns success.

Syntax

DWORD InventoryNtmsLibrary(
  [in] HANDLE      hSession,
  [in] LPNTMS_GUID lpLibraryId,
  [in] DWORD       dwAction
);

Parameters

[in] hSession

Handle to the session returned by the OpenNtmsSession function.

[in] lpLibraryId

Unique identifier of a library object.

[in] dwAction

Action to perform. This parameter can be one of the following values.

Value Meaning
NTMS_INVENTORY_OMID
A full on-media inventory is performed. Each side of each medium must be mounted into a drive. This is a time consuming process.
NTMS_INVENTORY_FAST
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).
NTMS_INVENTORY_DEFAULT
Use the InventoryMethod specified in the library object (see NTMS_LIBRARYINFORMATION).
NTMS_INVENTORY_STOP
Stop the current inventory in the specified library.

Return value

This function returns one of the following values.

Value Meaning
ERROR_ACCESS_DENIED
Access to one or more RSM objects is denied.
ERROR_DEVICE_NOT_AVAILABLE
The library is not currently connected.
ERROR_INVALID_HANDLE
The value specified in the hSession parameter is not valid.
ERROR_INVALID_LIBRARY
The library is the offline library.
ERROR_INVALID_PARAMETER
The library ID or session ID is not valid.
ERROR_NOT_CONNECTED
Unable to connect to the RSM service.
ERROR_SUCCESS
The function was successful.

Remarks

Not present libraries cannot be inventoried.

The InventoryNtmsLibrary function marks all the slots that currently contain a medium in the library for classification/identification. The InventoryNtmsLibrary function returns when all the media is marked.

Requirements

Requirement Value
Minimum supported client Windows XP [desktop apps only]
Minimum supported server Windows Server 2003 [desktop apps only]
Target Platform Windows
Header ntmsapi.h
Library Ntmsapi.lib
DLL Ntmsapi.dll

See also

AccessNtmsLibraryDoor

Library Control Functions