6.4.1 Adding, Removing, and Modifying Schema Classes

A network administrator might discover that the classes offered in the base schema of a namespace are inadequate for the client's needs. In that case, a whole new class of object may be required. Consider the FaxQueue example. In order to distinguish the fax queues on the network from the print queues, a new class, FaxQueue, could be added to the schema.

Example 2: Adding the FaxQueue Class (Visual Basic)

Dim Schema as IADsContainer

Dim FQClass as IADsClass

' Bind to the SCHEMA container.

Set Schema = GetObject("WinNT://MSFT/SCHEMA")

' Create the new FaxQueue class in the SCHEMA container.

Set FQClass = Schema.Create("Class", "FaxQueue")

' Set some of the attribute of the new class.

'

' This code fragment assumes that the client has generated a GUID for

' the new class using the UUIDGEN utility, and has placed the

' value of the GUID into the FQGUID variable.

FQClass.GUID = FQGUID

FQClass.Container = False

' Set the FaxQueue class to derive from the PrintQueue class.

FQClass.DerivedFrom = Array("WinNT://MSFT/SCHEMA/PrintQueue")

' Complete the operation and create the new class in the schema.

FQClass.SetInfo