Platform SDK: Active Directory, ADSI, and Directory Services

IADsMembers Property Methods

The methods of the IADsMembers interface read and write the properties described in this topic. For more information see Interface Property Methods.

Properties in Vtable Order

Property Description
Count

[Visual Basic]
Access: Read
Data Type: LONG

[C++]
HRESULT get_Count
([out] LONG *plCountr);

Indicates the number of items in the container. If the filter is set then count returns only the number of items that fit the filter description.
Filter

[Visual Basic]
Access: Read/Write
Data Type: VARIANT

[C++]
HRESULT get_Filter
([out] VARIANT *pvFilter);


HRESULT put_Filter
(
[in] VARIANT vFilter);

Indicates the filter. The syntax of the entries in the filter array is the same as the Filter used on the IADsContainer interface.

Remarks

The ADSI system providers do not support the IADsMembers::get_Count property method.

Example Code [Visual Basic]

The following Visual Basic code snippet provides an example of using the property methods of this interface.

Dim grp as IADsGroup
Set grp = GetObject("WinNT://myComputer/someGroup")
grp.members.filter = Array("user")
For each usr in grp.members
    MsgBox usr.Name & "," & usr.Class & "," & usr.AdsPath
Next 

Example Code [C++]

The following C++ code snippet uses the IADsMembers::get_Filter method to select the collection of users.

IADsGroup *pGroup;
HRESULT hr;

LPWSTR grpPath = L"WinNT://myComputer/someGroup";
hr = ADsGetObject(grpPath,IID_IADsGroup,(void**)&pGroup);
if(FAILED(hr)) exit(hr);

IADsMembers *pMembers;
hr = pGroup->Members(&pMembers);
if(FAILED(hr)) exit(hr);
hr = pGroup->Release();

SAFEARRAY *sa = CreateSafeArray(L"user");
hr = pMembers->put_Filter(sa);

hr = EnumMembers(pMembers);    // See code snippet in
                               // IADsMembers::get__NewEnum.
if(pMembers) pMembers->Release();

See Also

IADsContainer, IADsMembers::get__NewEnum, IADsMembers, Interface Property Methods