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

Property Description
Count

[Visual Basic]
Access: Read-only
DataType: 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
DataType: 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 code example shows how to use the property methods of this interface.

Dim grp As IADsGroup
On Error GoTo Cleanup

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

Cleanup:
	If (Err.Number<>0) Then
		MsgBox("An error has occurred. " & Err.Number)
	End If
	Set grp = Nothing

Example Code [C++]

The following code example uses the IADsMembers::get_Filter method to select the collection of users.

IADsGroup *pGroup;
HRESULT hr = S_OK;

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

IADsMembers *pMembers;
hr = pGroup->Members(&pMembers);
if(FAILED(hr)){goto Cleanup;}

hr = pGroup->Release();

SAFEARRAY *sa = CreateSafeArray(L"user");
hr = pMembers->put_Filter(sa);
if(FAILED(hr)){goto Cleanup;}

hr = EnumMembers(pMembers); // For more information, and a code example, see
							 // IADsMembers::get__NewEnum.
if(FAILED(hr)){goto Cleanup;}

Cleanup:
	if(pGroup) pGroup->Release();
	if(pMembers) pMembers->Release();
	return hr;

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

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