IADsPropertyList::Next method

The IADsPropertyList::Next method gets the next item in the property list. The returned item is a Property Entry object.

Syntax

HRESULT Next(
  VARIANT *pVariant
);

Parameters

pVariant

Address of a caller-allocated variable that contains the value of the next item in the property list. The return value of VT_DISPATCH refers to an IDispatch interface pointer to an object implementing the IADsPropertyEntry interface.

Return Value

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:

For more information and other return values, see ADSI Error Codes.

Remarks

You must clear pVariant using VariantClear when the value returned by the Next method is no longer required.

Examples

The following code example shows how to walk through a property list using the Next method.

VB
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.
C++
////////////////////////////////////
// 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;

}

Requirements

   
Windows version Windows Vista Windows Server 2008
Target Platform Windows
Header iads.h
DLL Activeds.dll

See Also

ADSI Error Codes

IADsPropertyEntry

IADsPropertyList

IADsPropertyList Property Methods

IDispatch