Directory Services |
The IADsPropertyList::Next method gets the next item in the property list. The returned item is a Property Entry object.
HRESULT Next( VARIANT* pVariant );
This method supports the standard HRESULT values, including S_OK if the item is obtained. When the last item in the list is returned, the return value that is returned will differ depending on which provider is used. The following codes are used to indicate that the last item in the list was obtained:
Return Code | Description |
---|---|
E_FAIL | Used for the LDAP provider. |
E_ADS_PROPERTY_NOT_FOUND | Used for the WinNT provider. |
E_FAIL | Used for the NDS provider. |
E_ADS_BAD_PARAMETER | Used for the NWCOMPAT provider. |
For more information and other return values, see ADSI Error Codes.
You must clear pVariant using VariantClear when the value returned by the Next method is no longer required.
The following code example shows how to walk through a property list using the Next method.
Dim propList As IADsPropertyList Dim v as Variant Dim propVal As IADsPropertyValue On Error Resume Next Set propList = GetObject("LDAP://dc01/DC=Fabrikam,DC=com") propList.GetInfo Set v = propList.Next() While (Not (IsNull(v)) And Err.Number = 0) Set propEnty = v Debug.Print v.Name Debug.Print v.AdsType Set v = propList.Next Wend
The following C++ code example shows how to work the IADsPropertyList::Next method.
//////////////////////////////////// // Function used to retrieve an entry using the // IADsPropertyList::Next method. // name: GetNextEntry // input: IADsPropertyList* // return: IADsPropertyEntry // uses: IADsPropertyList::Next ///////////////////////////////////////////////////////// IADsPropertyEntry* GetNextEntry(IADsPropertyList* pList) { VARIANT var; VariantInit(&var); IADsPropertyEntry *pEntry; if(!pList) { _tprintf("An error has occurred."); return NULL; } HRESULT hr = pList->Next(&var); hr = V_DISPATCH(&var)->QueryInterface(IID_IADsPropertyEntry, (void**)&pEntry); VariantClear(&var); return pEntry; }
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 Iads.h.
ADSI Error Codes, IADsPropertyEntry, IADsPropertyList, IADsPropertyList Property Methods, IDispatch