大网数据广告活动
域与目录服务

IADsMembers Property Methods (Iads.h)

· 52CE 我爱测

The methods of the IADsMembers interface read and write the properties described in this topic. For more information, see Interface 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

Count

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.

Access type: Read-only

Scripting data type: LONG

// C++ method syntax
HRESULT get_Count(
  [out] LONG* plCountr
);

Filter

Indicates the filter. The syntax of the entries in the filter array is the same as the Filter used on the IADsContainer interface.

Access type: Read/write

Scripting data type: VARIANT

// C++ method syntax
HRESULT get_Filter(
  [out] VARIANT* pvFilter
);
HRESULT put_Filter(
  [in] VARIANT vFilter
);

Remarks

The ADSI system providers do not support the IADsMembers::get_Count property method.

Examples

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

The following code example uses the IADsMembers::put_Filter method to prepare for an enumeration of the collection of members of a group.

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

Requirement Value
Minimum supported client Windows Vista
Minimum supported server Windows Server 2008
Header Iads.h
DLL Activeds.dll
IID IID_IADsMembers is defined as 451A0030-72EC-11CF-B03B-00AA006E0975

See also

IADsContainer

IADsMembers::get__NewEnum

IADsMembers

Interface Property Methods

Source: Microsoft Learn / Windows Win32 documentation by Microsoft and contributors. Documentation licensed CC BY 4.0. Code samples are covered by the MIT License. Converted from Markdown, with links normalized and embedded media omitted.

资料来源与适用范围

资料来源
Microsoft Learn / Windows Win32 documentation
适用范围
Windows Win32 API · Source date 05/31/2018
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY 4.0 (documentation), MIT (code samples)

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。