Export (0) Print
Expand All

IADsGroup::Members method

The IADsGroup::Members method retrieves a collection of the immediate members of the group. The collection does not include the members of other groups that are nested within the group.

Syntax


HRESULT Members(
  [out]  IADsMembers **ppMembers
);

Parameters

ppMembers [out]

Pointer to an IADsMembers interface pointer that receives the collection of group members. The caller must release this interface when it is no longer required.

Return value

This method supports the standard return values, including S_OK. For more information and other return values, see ADSI Error Codes.

Remarks

The IADsMembersMembers method will use the same provider.

Examples

The following code example enumerates all members of a group.


Dim grp As IADsGroup
Dim memberList As IADsMembers
Dim member As IADs

On Error GoTo Cleanup
 
Set grp = GetObject("WinNT://Microsoft/Administrators")
Set memberList = grp.Members
For Each m In memberList
    Set member = m
    Debug.Print member.Name & "(" & member.Class & ")"
Next

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

The following code example enumerates all members of a group.


HRESULT EnumerateGroupMembers(IADsGroup *pGroup)
{
    IADsMembers *pMembers;
    HRESULT hr = S_OK;
    hr = pGroup->Members(&pMembers);
    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(pMembers)
        pMembers->Release();

    return hr;
}

Requirements

Minimum supported client

Windows Vista

Minimum supported server

Windows Server 2003

Header

Iads.h

DLL

Activeds.dll

IID

IID_IADsGroup is defined as 27636B00-410F-11CF-B1FF-02608C9E7553

See also

IADsMembers
IADsGroup
IADsGroup Property Methods
ADSI Error Codes

 

 

Show:
© 2015 Microsoft