<div class="content" name="EnumerateNtmsObjectR" uuid="51d5d8fe-503e-48e4-a58d-ca9f2868d68a"><p>The EnumerateNtmsObjectR method enumerates the objects of
the container specified by <i>lpContainerId</i>.</p><dl>
<dd>
<div><pre> HRESULT EnumerateNtmsObjectR(
   [in, unique] const LPNTMS_GUID lpContainerId,
   [out, size_is(*lpdwListBufferSize), length_is(*lpdwListSize)] 
     LPNTMS_GUID lpList,
   [in] DWORD* lpdwListBufferSize,
   [out] DWORD* lpdwListSize,
   [out] DWORD* lpdwOutputSize,
   [in] DWORD dwType,
   [in] DWORD dwOptions
 );
</pre></div>
</dd></dl><p><b>lpContainerId: </b>A pointer to the identifier of
the container for which to enumerate objects. If this parameter is set to NULL,
top-level objects MUST be enumerated.</p><dl>
<dd>
<p>If the <i>lpContainerId</i> parameter is set to
NULL, the server MUST enumerate top-level objects (such as libraries). If more
than one object is listed, the object can be enumerated from more than one
container. The NULL container is the highest-level container, and enumerates
all objects in a system. <i>lpContainerId</i> can be an object identifier (for
example, a library identifier) which would return the objects associated with
it, depending on the type of object chosen in the <i>dwType</i> parameter.</p>
</dd></dl><p><b>lpList: </b>An array of identifiers for the
objects of <i>lpContainerId</i>.</p><p><b>lpdwListBufferSize: </b>A pointer to the size, in
bytes, of the <i>lpList</i> buffer. </p><p><b>lpdwListSize: </b>A pointer to the number of
elements in <i>lpList</i>.</p><p><b>lpdwOutputSize: </b>A pointer to the required size
of the <i>lpdwListSize</i> parameter if more data need to be returned than can
fit in the <i>lpList</i> buffer. In such a case, <i>lpdwListSize</i> MUST be
set to 0.</p><p><b>dwType: </b>A value from the <a href="5b190198-a0cb-4e20-90a3-234009357051" data-linktype="relative-path">NtmsObjectsTypes (section 2.2.1.6)</a>
enumeration specifying the type of the container.</p><p><b>dwOptions: </b>Enumeration options. This is
applicable only when <b>dwType</b> is NTMS_MEDIA_POOL; if <b>dwType</b> is not
NTMS_MEDIA_POOL, this MUST be set to NTMS_ENUM_DEFAULT</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 an object was denied.</td>
 </tr><tr>
  <td>0x80070008 ERROR_NOT_ENOUGH_MEMORY</td>
  <td>An allocation failure occurred during processing.</td>
 </tr><tr>
  <td>0x80070057 ERROR_INVALID_PARAMETER</td>
  <td>The parameter is NULL or invalid.</td>
 </tr><tr>
  <td>0x800710D8 ERROR_OBJECT_NOT_FOUND</td>
  <td>The lpContainerId parameter is invalid.</td>
 </tr><tr>
  <td>0x8007007A ERROR_INSUFFICIENT_BUFFER</td>
  <td>The specified buffer size is too small. The required size is returned in the lpdwOutputSize parameter.</td>
 </tr></tbody></table>
</dd></dl><p>Upon receiving this message, the server MUST verify that <i>lpdwListSize</i>
is not NULL. If it is NULL, the server MUST immediately fail the operation and
return ERROR_INVALID_PARAMETER (0x80070057).</p><p>If parameter validation succeeds, the server MUST verify
that the user has the required access rights, and get the object type code from
the RSM object type. If the client does not have the required access rights, the
server MUST return ERROR_ACCESS_DENIED (0x80070005).</p><p>The server behavior depends upon the value of <i>dwOptions</i>.</p><table><thead>
  <tr>
   <th>
   <p> Value </p>
   </th>
   <th>
   <p> Meaning </p>
   </th>
  </tr>
 </thead><tbody><tr>
  <td>NTMS_ENUM_DEFAULT 0x00000000</td>
  <td>Do not include enumeration of the root pool when enumerating the media pools.</td>
 </tr><tr>
  <td>NTMS_ENUM_ROOTPOOL 0x00000001</td>
  <td>Enumerates the root pool, in addition to all other top-level media pools. The root pool MUST be returned as the first GUID in the list. Enumerating the root pool is only required to get or set the security attributes on the object. dwType MUST be NTMS_MEDIA_POOL and lpContainerId MUST be NULL.</td>
 </tr></tbody></table><p>If the total size of available object IDs is greater than
the current buffer size, the server MUST return ERROR_INSUFFICIENT_BUFFER
(0x0000007A) and set <i>lpdwOutputSize</i> to the required size and set <i>lpdwListSize</i>
to 0. The client can then <a href="8d988f06-72be-47cf-9e09-9060aa8ed897#gt_0e546e86-71c4-45cc-9ef1-4a78f6cb425a" data-linktype="relative-path">allocate</a>
a larger buffer and try again.</p><p>Since an ID can be added by another process, it is possible
for a subsequent method with a resized list to get an error indicating that the
list is too small. If the <i>lpContainerId</i> parameter is set to NULL, RSM
MUST enumerate top-level objects (such as libraries).</p><p>If more than one object is listed, the object can be
enumerated from more than one container. The NULL container is the
highest-level container, and enumerates all objects in a system. </p></div>