Platform SDK: Exchange 2000 Server

Creating Content Class Definitions

[This is preliminary documentation and subject to change.]

There are four specifications for a content-class definition:

  1. You create an item to hold the content class definition and give it a name.
  2. You specify the content class for the content class definition itself as urn:content-classes:contentclassdef.
  3. You specify the content classes the new content class extends, also known as which content classes it inherits.

    This specification is optional.

  4. You specify each property that belongs to the content-class.
[VBScript]
Const adModeReadWrite       = 3
Const adFailIfNotExists     = -1
Const adCreateNonCollection = 0

'this task defines a content class for the cookbook scenario

Dim strURL
strURL = "file://./backofficestorage/microsoft.com/public folders/cookbook/schema/"

Dim Rec
Set Rec = CreateObject("ADODB.Record")

' Create a content class definition item in my application
'   schema folder.
Rec.Open strURL & "ccdef",,adModeReadWrite, adCreateNonCollection

Dim Flds
Set Flds = Rec.Fields

With Flds

  ' Name the content class.
  .Item("urn:schemas-microsoft-com:xml-data#name").Value = _
   "urn:schemas-microsoft-com:content-classes:cookbook"

  ' The content class of the definition item.
  .Item("DAV:contentclass") = "urn:content-classes:contentclassdef"

  ' The content classes it extends (inherits from).
  .Item("urn:schemas-microsoft-com:xml-data#extends").Value = _
      Array("urn:content-classes:item", "urn:content-classes:person")

  ' The properties to belong to this content class.
   .Item("urn:schemas-microsoft-com:xml-data#element").Value = _
       Array("urn:schemas-microsoft-com-cookbook:submitdate",_
             "urn:schemas-microsoft-com-cookbook:cuisine", _
             "urn:schemas-microsoft-com-cookbook:title", _
             "urn:schemas-microsoft-com-cookbook:ingredients", _
             "urn:schemas-microsoft-com-cookbook:instructions", _
             "urn:schemas-microsoft-com-cookbook:rating")

   'If you are defining a folder content class, this is a good place
   'to specify expected content class. Then you wouldn't have to specify
   'all participating content classes on all folders.
   '.Item("urn:schemas-microsoft-com:exch-data:expected-content-class").Value = _
   '  Array("urn:schemas-microsoft-com:content-classes:aclass", _
   '  "urn:schemas-microsoft-com:content-classes:anotherclass")


   .Update
Rec.Close

   .Update
End With

Rec.Close