IADsGroup Property Methods

The property methods of the IADsGroup interface read and write the following properties. For more information, see Interface Property Methods.

Properties

Description

Indicates the textual description of the group membership.

Access type: Read/write

Scripting data type: BSTR

// C++ method syntax
HRESULT get_Description(
  [out] BSTR* pbstrDescription
);
HRESULT put_Description(
  [in] BSTR bstrDescription
);

Remarks

Using IADsGroup to Retrieve Descriptions of Built-in Groups

The following examples show how to retrieve information about Windows group objects by name. In a multilingual environment, built-in groups are sometimes known by different localized names, which means that they cannot be retrieved directly by using string identifiers such as "WinNT://Microsoft/Administrators". In that case, the user can bind to the well-known SID object for the group, retrieve the localized group name, and supply that to the GetObject method. For more information, see Well-known SIDs.

Examples

The following Visual Basic example shows how to bind to a group object and display the description of the group.

Dim grp As IADsGroup
On Error GoTo Cleanup

Set grp = GetObject("WinNT://Microsoft/Administrators")
Debug.Print grp.Description

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

The following C++ example shows how to bind to a group object and display the description of the group.

IADsGroup *pGroup = NULL;
HRESULT hr = S_OK;
LPWSTR adsPath = L"WinNT://localHost/Administrators";
BSTR bstr;

hr = ADsGetObject(adsPath,IID_IADsGroup,(void**)&pGroup);

if(FAILED(hr)) {goto Cleanup;}

hr = pGroup->get_Description(&bstr);
if(FAILED(hr)) {goto Cleanup;}

printf("Description: %S\n",bstr);

Cleanup:
    SysFreeString(bstr);
    if(pGroup) 
        pGroup->Release();

    return hr;

Requirements

Requirement Value
Minimum supported client
Windows Vista
Minimum supported server
Windows Server 2008
Header
Iads.h
DLL
Activeds.dll
IID
IID_IADsGroup is defined as 27636B00-410F-11CF-B1FF-02608C9E7553

See also

IADs

IADsGroup

Interface Property Methods