Platform SDK: Active Directory, ADSI, and Directory Services |
An ADSI extension is a special COM object that allows developers to extend an ADSI object. Each extension is associated with a specified class in the directory. With this extension model, developers can add methods to give more dynamic meaning to an object. In a traditional directory programming model, an object is accessed by getting and setting the object's attributes. Using ADSI extensions, you can add more functionality to a directory object.
The way in which extension methods are implemented is up to the extension writer. An extension writer may even implement a method that is completely outside the scope of the directory. For example, imagine that a developer of backup and restore software is planning to extend an object called computer. The developer will need to create two methods: BackUp and Restore. These methods will operate remotely on the physical computer that the computer object in the directory is pointing to. By participating as an extension, the component automatically gains access to the ADSI infrastructure and is viewed by ADSI clients as an integral part of the object.
Of course, not all components are viable ADSI extensions. The following guidelines should help you decide if creating an ADSI extension is appropriate:
Now, a user may search for all instances of FooApp in the directory. For each object returned, the user may issue a call to NotifyNow(), for instance. Your application/extension will be able to get more information about the current object in the directory and notify each server asynchronously.
For ADSI clients, extensions enrich the ADSI programming environment in many ways:
ADSI extensions were designed with the following goals:
Consider this scenario, a corporate developer or an ISV needs to develop a backup program. This backup program allows an administrator to back up all computers in the organizational unit he or she manages. With an ADSI extension, the following script is possible:
Dim ou as IADsContainer Set ou = GetObject("LDAP://OU=Sales, DC=Microsoft, DC=COM") ou.Filter = Array("computer") For each comp in ou Debug.Print comp.Get("dnsHostName") Debug.Print comp.LastBackUp comp.BackUpNow Next
LastBackUp is a property and BackUpNow is a method that the extension writer provides. The code illustrates the benefits for both extension consumers and providers. The extension writer does not have to reinvent a new way of filtering, searching, and accessing the directory. The extension consumer, on the other hand, does not have to re-learn a new programming paradigm. New methods and properties that the extension writer provides are viewed as if they are part of ADSI.
This section describes the following topics: