Using IADs

In the ADSI environment, each element of a directory service is represented by an ADSI object, which is a Component Object Model (COM) object that supports the standard COM IUnknown interface as well as IDispatch and IADs. IADs supplies the basic house-keeping functions for ADSI objects.

The preceding figure shows a generic ADSI object supporting the fundamental interfaces IADs, IADsPropertyList, IUnknown, IDirectoryObject, and IDispatch. An ADSI object such as this manages data from the data store of the underlying directory service through the interfaces it supports. This data is known as the properties of the object, and the routines that retrieve and set these properties are known as property methods. Read-only properties have one property method that sets the value of the property. Read-write properties have two methods: one that sets the value and one that gets the value. Properties are implemented on each ADSI object using a property cache. IADs::get_ADsPath and IADs::put_ADsPath are examples of property methods. Property methods are not apparent to Visual Basic and other Automation clients that allow direct references to the property. For example, Visual Basic refers to IADS::ADsPath directly using the Object.ADsPath syntax. For more information, see Interface Property Methods.

In addition, an ADSI object interacts with other ADSI objects and directly to a namespace through methods. Methods execute immediately Examples of methods include IADs::SetInfo, IADs::GetInfo, and IADsPrintJobOperations::Pause.

Properties, property methods, and methods are all accessed through standard COM interfaces.

An ADSI object is uniquely identified by its ADsPath. An example of an ADsPath for the LDAP namespace is "LDAP://MyServer/OU=Seattle". For programmers familiar with COM monikers, this is conceptually similar to the COM moniker display name.

Any ADSI object that contains other ADSI objects (an ADSI container object) also supports the IADsContainer interface, which provides methods and properties that manage the creation, deletion, and enumeration of ADSI objects that are contained by the object. The following figure shows an ADSI container object.

Almost all ADSI objects are contained by other objects. The only ADSI object with no parent container is the top-level ADSI Namespaces object ("ADS:").

The IADs::SetInfo method on a container object persistently stores the cached properties of the ADSI container object to storage in addition to any objects that have been created with the IADsContainer::Create method. IADsContainer::Deletedoes not affect the property cache but deletes the underlying namespace directory element represented by this object immediately.