Directory Services

IADsPropertyList::Skip

The IADsPropertyList::Skip method skips a specified number of items, counting from the current cursor position, in the property list.

HRESULT Skip( 
  ULONG cElements
);

Parameters

cElements
[in] Number of elements to be skipped.

Return Values

This method supports the standard HRESULT return values, including S_OK. For more information and other return values, see ADSI Error Codes.

Example Code [Visual Basic]

The following code example shows how Skip is used in selecting every other item in a property list.

Dim propList As IADsPropertyList
 
On Error Resume Next
 
Set propList = GetObject("LDAP://DC=Fabrikam,DC=com")
 
propList.GetInfo
 
Set v = propList.Next()
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 Sub
	End If
 

	propList.Skip (1) 'Skip every other property
	Set v = propList.Next

Wend

Example Code [C++]

The following code example shows the effect produced by calls to IADsPropertyList::Skip method. See IADsPropertyList interface for the code listing of the GetPropertyCache function. The listing of GetNextEntry is given in IADsPropertyList::Next.

IADsPropertyList *GetPropertyCache(LPWSTR);
IADsPropertyEntry *PropertyNext(IADsPropertyList *);
 
void TestSkipList()
{
	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("Walking up the property list without skipping: \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();
 
	printf("Parsing the property list, skipping every other element: \n");
 
	for (i=0; i<count; i+=2)
	{
		pList->Skip(1);
		pEntry = GetNextEntry(pList);
		hr = pEntry->get_Name(&bstr);
		if(SUCCEEDED(hr))
		{
			printf("   Name : %S\n",bstr);
			SysFreeString(bstr);
	}
}
 
	pEntry->Release();
	pList->Release();
}

Requirements

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.

See Also

ADSI Error Codes, IADsPropertyList, IADsPropertyList::Next, IADsPropertyList Property Methods