Platform SDK: Active Directory, ADSI, and 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 other return values, see ADSI Error Codes.

Example Code [Visual Basic]

The following Visual Basic code snippet 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=Microsoft,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 C++ code snippet shows the effect produced by calls to IADsPropertyList::Skip method. See IADsPropertyList interface for the code listing of the GetPropertyCache function. The listing of PropertyNext is given in IADsPropertyList::Next.

IADsPropertyList *GetPropertyCache(LPWSTR);
IADsPropertyEntry *PropertyNext(IADsPropertyList *);
 
void TestSkipList()
{
    IADsPropertyEntry *pEntry;
    IADsPropertyList *pList;
    long count;
    BSTR bstr;
 
    pList=GetPropertyCache(L"WinNT://kding1,computer");
 
    pList->get_PropertyCount(&count);
    printf("Walking up the property list without skipping: \n");
    for (int i=0; i<count; i++) {
        pEntry = PropertyNext(pList);
        pEntry->get_Name(&bstr);
        printf("   Name : %S\n",bstr);
    }
 
    pList->Reset();
 
    printf("Walking up the property list, skipping every other element: \n");
 
    for (i=0; i<count; i+=2) {
        pList->Skip(1);
        pEntry = PropertyNext(pList);
        pEntry->get_Name(&bstr);
        printf("   Name : %S\n",bstr);
    }
 
    pEntry->Release();
    pList->Release();
    SysFreeString(bstr);
}

Requirements

  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.

See Also

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