Platform SDK: Active Directory, ADSI, and Directory Services

ADsEnumerateNext

The ADsEnumerateNext function walks through a specified number of elements from the current cursor position of the enumerator. When the operation succeeds, the function returns the enumerated set of elements in a variant array. The number of returned elements can be smaller than the specified number.

HRESULT ADsEnumerateNext(
  IEnumVARIANT *pEnumVariant, 
  ULONG cElements, 
  VARIANT FAR *pvar, 
  ULONG FAR *pcElementsFetched 
);

Parameters

pEnumVariant
[in] Pointer to the IEnumVARIANT interface on the enumerator object.
cElements
[in] Number of elements requested.
pvar
[in] Pointer to the array of elements retrieved.
pcElementsFetched
[out] Actual number of elements retrieved, which can be smaller than the number of elements requested.

Return Values

This method supports the standard return values, as well as the following:

S_OK
The variant array has been populated successfully and the number of items returned is the same as those requested (cElement = *pcElementFetched).
S_FALSE
The call succeeded, but the number of items returned is less than those requested.

For other return values, see ADSI Error Codes.

Remarks

The general procedure to enumerate objects in a container involves the following:

  1. Calling ADsBuildEnumerator to create an enumerator object.
  2. Performing enumeration by calling ADsEnumerateNext on the newly created enumerator.
  3. Freeing the enumerator by using ADsFreeEnumerator.

For more information and a code example, see the ADsBuildEnumerator topic.

Requirements

  Windows NT/2000: Requires Windows 2000 (or Windows NT 4.0 with DSClient).
  Windows 95/98: Requires Windows 95 or later (with DSClient).
  Header: Declared in Adshlp.h.
  Library: Included as a resource in ActiveDs.dll.

See Also

ADSI Error Codes, ADSI Functions, ADsBuildEnumerator, ADsFreeEnumerator, FreeADsMem, IEnumVARIANT