Directory Services


The ADsFreeEnumerator function frees an enumerator object created with the ADsBuildEnumerator function.

HRESULT ADsFreeEnumerator(
  IEnumVARIANT* pEnumVariant


[in] Pointer to the IEnumVARIANT interface on the enumerator object to be freed.

Return Values

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

Return Code Description
S_OK The enumerator object was freed successfully.
E_ADS_BAD_PARAMETER The specified enumerator is invalid.


The general process for enumerating objects in a container is as follows.

First, create an enumerator object on that container.

Second, retrieve the IEnumVARIANT interface pointer.

Third, call the ADsEnumerateNext function to return an enumerated set of elements from the enumerator object.

Fourth, call the ADSFreeEnumerator function to free the enumerator object.

For more information and a code example, see ADsBuildEnumerator.


Client: Included in Windows XP and Windows 2000 Professional.
Server: Included in Windows Server 2003 and Windows 2000 Server.
Redistributable: Requires Active Directory Client Extension on Windows NT 4.0 SP6a and Windows 95/98/Me.
Header: Declared in Adshlp.h.
Library: Use ActiveDS.lib.

See Also

ADSI Error Codes, ADSI Functions, ADsBuildEnumerator, ADsEnumerateNext, IEnumVARIANT