Platform SDK: Active Directory, ADSI, and Directory Services

Enumerating Members in a Group

The members of a group are stored in a multi-valued property called member. For groups with a small to medium-sized membership, you can use the IADsGroup::Members method to get a pointer to an IADsMembers object containing the list of all members and then use the IADsMembers::get__NewEnum to get an enumerator object that you can use to enumerate the members.

For the group membership is potentially large, you should use ranging to retrieve users one range at a time. For information on using ranging to enumerate members, see Enumerating Groups That Contain Many Members.