6.2 Browsing the Schema

The schema management objects are useful for browsing the definition of a schema class or browsing the schema classes available in a schema. There are two basic ways to do this:

Obtain an object's schema definition using the IADs::get_Schema method.

Find and enumerate the contents of a schema container.

Example 1: Browsing a Schema Class Definition (Visual Basic)

Dim u As IADsUser

Dim class As IADsClass

Dim property As IADsProperty

dim V as Variant

Set u = GetObject("WinNT://MyDomain/MyMachine/Administrator,user")

Set class = GetObject(u.Schema)

Debug.Print "Class: " & class.Name

Debug.Print "GUID: " & class.GUID

Debug.Print "Implemented by: " & class.CLSID

If class.Container = True Then

Debug.Print "Container Object"

Else

Debug.Print "Leaf Object"

End If

Debug.Print "Class contain: "

For Each ContainmentClass In class.Containment

Debug.Print ContainmentClass

Next ContainmentClass

Debug.Print "Properties in this Class: "

For Each property In class

Debug.Print property.Name & " "

Next property