Skip to content

IADsMembers

The IADsMembers interface is designed for managing a list of ADSI object references. It is implemented to support group membership for individual accounts. It can also be used to manage a collection of ADSI objects belonging to a group.

The IADsMembers interface serves a slightly different purpose from the IADsCollection and IADsContainer interfaces, which also work with a set of data or objects. IADsCollection manages sets of arbitrary data elements that are not object references, whereas IADsContainer manages objects that are part of the directory tree structure.

Inheritance: The IADsMembers interface inherits from the IEnumerable interface.

Methods

  • Method

  • Description

  • GetEnumerator()

  • Retrieves an enumerator object for this ADSI collection object.

Properties

  • Property

  • Description

  • Count

  • Gets the number of items in the collection.

  • Filter

  • Gets or sets the filter used to select object classes in the given enumeration.

Details

GetEnumerator()

Retrieves an enumerator object for this ADSI collection object. The enumerator object implements the IEnumerator interface that can be used to enumerate objects in foreach loops.

IEnumerator GetEnumerator()

Examples

The following code sample enumerates members of a group.

[Reflection.Assembly]::LoadWithPartialName("Softerra.Adaxes.Adsi")

# Connect to the Adaxes service
$admNS = New-Object("Softerra.Adaxes.Adsi.AdmNamespace")
$admService = $admNS.GetServiceDirectly("localhost")

# Bind to the group
$groupDN = "CN=SalesGroup,CN=Users,DC=domain,DC=com"
$group = $admService.OpenObject("Adaxes://$groupDN", $NULL, $NULL, 0)

# Enumerate all members of the group
foreach($member in $group.Members())
{
    Write-Host "Object Name:" $member.Name ", Object Class:" $member.Class
}
using System;
using Softerra.Adaxes.Adsi;
using Softerra.Adaxes.Interop.Adsi;
using Softerra.Adaxes.Interop.Adsi.PersistentObjects;
class Program
{
    static void Main(string[] args)
    {
        // Connect to the Adaxes service
        AdmNamespace adsNS = new AdmNamespace();
        IAdmService admService = adsNS.GetServiceDirectly("localhost");

        // Bind to the group
        const string groupPath= "Adaxes://CN=SalesGroup,CN=Users,DC=domain,DC=com";
        IADsGroup group = (IADsGroup)admService.OpenObject(
            groupPath, null, null, 0);

        // Enumerate all members of a group
        foreach (IADs member in group.Members())
        {
            Console.WriteLine("Object Name: {0}, Object Class: {1}",
                member.Name, member.Class);
        }
    }
}

Count

Gets the number of items in the collection. If the Filter property is set, this property gets only the number of items that fit the filter.

  • Type:
  • Int32
  • Access:
  • Read-only

Filter

Gets or sets the filter used to select object classes in the given enumeration. This is an Object[] array, each element of which is the name of a schema class. If the property is not set, all objects of all classes are retrieved by the enumerator.

  • Type:
  • Object
  • Access:
  • Read/Write

Requirements

Minimum required version: 2009.1

See also