Platform SDK: Active Directory, ADSI, and Directory Services |
In Accessing and Manipulating Data with ADSI, there were several examples of enumeration. You can also enumerate the children of container objects. These children are objects themselves, rather than just properties on objects. The following example uses the IADsContainer interface and enumerates the children of the container.
Dim MyObject as IADs Dim Child as IADs Dim Container as IADsContainer On Error Resume Next Set MyObject = GetObject("LDAP://MyServer/DC=MyDomain,DC=Microsoft,DC=com") Set Container = MyObject If Err = 0 Then For Each Child in Container Debug.Print Child.Name Next Child EndIf