Obtaining Interface Pointers for DirectScript Objects

Before you can use the services of a DirectScript object, you need to obtain a pointer to its interface. This is quite simple to do using Visual Basic.

Dim NameSpace As IADsContainer
.
.
.
Set NameSpace = GetObject("NTDS:")

 

The code above uses the URL syntax and gets an interface pointer to the DirectScript provider. Note that NameSpace is declared as an IADsContainer and contains other objects. The OLE version will look like this:

Dim NameSpace As IADsContainer
.
.
.
Set NameSpace = GetObject("@NTDS!//")

 

You can also get pointers to objects further down in the chain by providing the IADsPath leading to them:

Dim User As IADsUser
Set User = GetObject("NTDS://QSOFT/John") '
Get the User object related to user John in the QSOFT domain