IADsPropertyList::Next method (iads.h)

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

Syntax

HRESULT Next(
  [out] VARIANT *pVariant
);

Parameters

[out] 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.

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;
}

Requirements

Requirement Value
Minimum supported client Windows Vista
Minimum supported server Windows Server 2008
Target Platform Windows
Header iads.h
DLL Activeds.dll

See also

ADSI Error Codes

IADsPropertyEntry

IADsPropertyList

IADsPropertyList Property Methods

IDispatch