Platform SDK: Active Directory, ADSI, and Directory Services |
The IADsGroup::Members method retrieves all the members of the group. It gets the IADsMembers interface on an ADSI collection object that represents the members of this group.
HRESULT IADsGroup::Members( IADsMembers ** ppMembers );
This method supports the standard return values, including S_OK. For other return values, see ADSI Error Codes.
The following Visual Basic code snippet enumerates all the members of a group.
Dim grp As IADsGroup Dim memberList As IADsMembers Dim member As IADs Set grp = GetObject("WinNT://Microsoft/Administrators") Set memberList = grp.members For Each member In memberList Debug.Print member.Name & "(" & member.Class & ")" Next
The following C++ code snippet enumerates all members of a group.
HRESULT EnumerateGroupMembers(IADsGroup *pGroup) { IADsMembers *pMembers; HRESULT hr = S_OK; hr = pGroup->Members(&pMembers); pGroup->Release(); if (FAILED(hr)) return hr; hr = EnumMembers(pMembers); // See code snippet in // IADsMembers::get__NewEnum. Pmembers->Release(); return hr; }
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.
IADsMembers, IADsGroup, IADsGroup Property Methods, ADSI Error Codes