Skip to content


The IADsCollection interface allows you to manage an arbitrary set of named data elements. Collections differ from arrays of elements in that individual items can be added or deleted without reordering the entire array.

Collection objects can represent one or more items that correspond persistent data, such as physical objects in the directory. All elements in a collection must be of the same type.

ADSI also exposes the IADsMembers and IADsContainer interfaces for manipulating two special cases of collection objects. IADsMembers is used for a collection of objects that share a common membership. An example of such objects are users that belong to a group. IADsContainer applies to a directory object that contains other objects. An example of this is a directory tree.

Inheritance: The IADsCollection interface inherits from the IEnumerator interface.




Adds a named item to the collection.

void Add(String itemName, Object itemToAdd)


  • itemName - Specifies the item name. The GetObject and Remove methods reference the item by this name.
  • itemToAdd - Specifies an object to be added to the collection.


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

IEnumerator GetEnumerator()


Gets an item of the collection.

Object GetObject(String itemName)


The itemName parameter specifies the name of the item. This is the same name passed to the Add method when the item is added to the collection.


Removes the named item from this collection object.

void Remove(String itemToBeRemoved)


The itemToBeRemoved parameter specifies the name of the item as it was specified by the Add method.


Minimum required version: 2009.1

See also