| Platform SDK: Active Directory, ADSI, and 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:
For other return values, see ADSI Error Codes.
The following Visual Basic code snippet 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=Microsoft,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 snippet shows how to work the IADsPropertyList::Next method.
////////////////////////////////////
// function 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;
HRESULT hr = pList->Next(&var);
hr = V_DISPATCH(&var)->QueryInterface(IID_IADsPropertyEntry,
(void**)&pEntry);
VariantClear(&var);
return pEntry;
}
IADsPropertyList *GetPropertyCache(LPWSTR);
void TestPropertyNext()
{
IADsPropertyList *pList;
pList=GetPropertyCache(L"WinNT://myComputer,computer");
IADsPropertyEntry *pEntry=GetPropertynext(&pList);
printf("Printing from TestPropertyNext()…\n");
BSTR bstr;
long ln;
hr = pEntry->get_Name(&bstr);
printf(" Name: %S\n",bstr);
SysFreeString(bstr);
hr = pEntry->get_ADsType(&ln);
printf(" Type: %d\n",ln);
hr = pEntry->get_ControlCode(&ln);
printf(" Code: %d\n",ln);
}
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 Iads.h.
ADSI Error Codes, IADsPropertyEntry, IADsPropertyList, IADsPropertyList Property Methods, IDispatch