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: IEnumerable
Methods
-
Method
-
Description
-
GetEnumerator()
-
Retrieves an enumerator object for this ADSI collection object.
Properties
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.
- PowerShell
-
[Reflection.Assembly]::LoadWithPartialName("Softerra.Adaxes.Adsi") # Connect to the Adaxes service $ns = New-Object("Softerra.Adaxes.Adsi.AdmNamespace") $service = $ns.GetServiceDirectly("localhost") # Bind to the group $groupDN = "CN=SalesGroup,CN=Groups,DC=domain,DC=com" $group = $service.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 }
- C#
-
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 ns = new AdmNamespace(); IAdmService service = ns.GetServiceDirectly("localhost"); // Bind to the group const string groupPath= "Adaxes://CN=SalesGroup,CN=Groups,DC=domain,DC=com"; IADsGroup group = (IADsGroup)service.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:
- int
- 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