Directory Services |
If not logged on to the NetWare server, use the net use command to log on before using any ADSI NWCOMPAT services. The following is an example.
net use \\nwserver /U:mydom\jeffsmith
This is required because IADsOpenDSObject::OpenDSObject is not supported in the current release of the NWCOMPAT provider.
This example enumerates the various ADSI objects of an NWCOMPAT server.
[Visual Basic]
servername = "ntmarst2"
adsPathName = "NWCOMPAT://" & serverName
Set cont = GetObject(adsPathName)
' Enumerate the server objects.
For Each obj In cont
Debug.Print obj.Name & " (" & obj.Class & ")"
Next
This example creates a new user with a username of "jeffsmith".
[Visual Basic]
adsPath = "NWCOMPAT://" & serverName
Set cont = GetObject(adsPath)
Set usr = cont.Create("user", "jeffsmith")
usr.SetInfo
This example changes a particular user's full name to "Jeff Smith".
[Visual Basic]
objPath = "jeffsmith,user"
adsPath = "NWCOMPAT://" & serverName & "/" & objPath
Set usr = GetObject(adsPath)
usr.FullName = "Jeff Smith"
usr.SetInfo
Searching is not supported in NWCOMPAT. You can, however, use the IADsContainer::put_Filter method to limit the type of object classes to be included in the enumeration.
[Visual Basic]
adsPath = "NWCOMPAT://" & serverName
Set con = GetObject(adsPath)
con.Filter = Array("user", "group") ' Show the user and group.
For Each acct In con
Debug.Print acct.Name & " (" & acct.Class & ")"
Next