Directory Services |
The IADsPropertyList::Reset method resets the list to the first item.
HRESULT Reset();
This method supports the standard HRESULT values, including S_OK. For more information and other return values, see ADSI Error Codes.
The following code example shows how the Reset method is used.
Dim propList As IADsPropertyList On Error Resume Next Set propList = GetObject("LDAP://DC=Fabrikam,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 code example shows the effect produced by a call to the IADsPropertyList::Reset method. The code of the GetPropertyCache and GetNextEntry functions are listed under IADsPropertyList and IADsPropertyList::Next accordingly.
IADsPropertyList *GetPropertyCache(LPWSTR); IADsPropertyEntry *PropertyNext(IADsPropertyList *); void TestResetItem() { IADsPropertyEntry *pEntry = NULL; IADsPropertyList *pList = NULL; long count; BSTR bstr; HRESULT hr; pList = GetPropertyCache(L"WinNT://myComputer,computer"); hr = pList->get_PropertyCount(&count); if(SUCCEEDED(hr)) { printf(" Count before item reset : %d\n",count); } printf("Walking up the property list before item reset: \n"); for (int i=0; i<count; i++) { pEntry = GetNextEntry(pList); hr = pEntry->get_Name(&bstr); if(SUCCEEDED(hr)) { printf(" Name : %S\n",bstr); SysFreeString(bstr); } } pList->Reset(); // Move the cursor to the beginning of the list. ResetItem(pList, L"Owner"); hr = pList->get_PropertyCount(&count); if(SUCCEEDED(hr)) { printf(" Count after item reset : %d\n",count); } printf("Walking up the property list after item reset: \n"); for (i=0; i<count; i++) { pEntry = GetNextEntry(pList); hr = pEntry->get_Name(&bstr); if(SUCCEEDED(hr)) { printf(" Name : %S\n",bstr); SysFreeString(bstr); } } pEntry->Release(); pList->Release(); }
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, IADsPropertyList, IADsPropertyList::Next, IADsPropertyList Property Methods