Active Directory objects are also OLE Automation Servers. All Active Directory interfaces can be invoked via the IDispatch interface.
The IDispatch interface is defined by OLE. It is the OLE Automation interface for controllers that do not use COM interfaces directly. Accessing an object through IDispatch is called name-bound or late-bound access, since the connection between the client and the OLE object (server) occurs at run time, and not when the client program is linked.
OLE Automation controllers like Visual Basic hide the inner workings of OLE, and call all of the necessary methods in IDispatch on behalf of the programmer. Programmers can concern themselves with the logic of their application, and not the low-level details of OLE.
Example 2: Creating a User Object (Visual Basic)
Dim Container as IOleDsContainer Dim NewUser as IOleDsUser ' Bind to the known container. Set Container = GetObject("@WinNT!MSFT") ' Create the new Active Directory User. Set NewUser = Container.Create("User", "Jane") ' Set Jane's password. NewUser.AccountRestrictions.SetPassword("Argus") ' Complete the operation to create the object in the directory. NewUser.SetInfo