Platform SDK: Active Directory, ADSI, and Directory Services |
The IADsPropertyList::Reset method resets the list to the first item.
HRESULT Reset(void);
This method supports the standard HRESULT values, including S_OK. For other return values, see ADSI Error Codes.
The following Visual Basic code snippet shows how the Reset method is used.
Dim propList As IADsPropertyList On Error Resume Next Set propList = GetObject("LDAP://DC=Microsoft,DC=com") propList.GetInfo Set v = propList.Next() Do While (Not (IsNull(v)) And Err.Number = 0) Set propEnty = v If v.Name = "uSNCreated" Then 'Item() method could be used instead. Debug.Print v.Name Debug.Print v.ADsType Exit Do End If Set v = propList.Next Loop propList.Reset
The following C++ code snippet shows the effect produced by a call to the IADsPropertyList::Reset method. The code of the GetPropertyCache and PropertyNext functions are listed under IADsPropertyList and IADsPropertyList::Next accordingly.
IADsPropertyList *GetPropertyCache(LPWSTR); IADsPropertyEntry *PropertyNext(IADsPropertyList *); void TestResetList() { IADsPropertyList *pList; pList=GetPropertyCache(L"WinNT://kding1,computer"); long count; pList->get_PropertyCount(&count); printf("Number of properties before reset: %d\n",count); printf("Walking up the property list before reset: \n"); IADsPropertyEntry *pEntry; BSTR bstr; for (int i=0; i<count-1; i++) { pEntry = PropertyNext(pList); pEntry->get_Name(&bstr); printf(" Name : %S\n",bstr); } count = -1; pList->Reset(); pList->get_PropertyCount(&count); printf("Number of properties after reset: %d\n",count); pEntry = PropertyNext(pList); pEntry->get_Name(&bstr); printf(" Name : %S\n",bstr); pEntry->Release(); pList->Release(); SysFreeString(bstr); }
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, IADsPropertyList, IADsPropertyList::Next, IADsPropertyList Property Methods