Platform SDK: Exchange 2000 Server

Creating Property Definitions

[This is preliminary documentation and subject to change.]

Creating property definition requires creating an item to contain the definition, assigning it a name, data type, and specifying urn:content-classes:propertydef as its content class.

Additionally, the property can specify any number of attributes such as indexed, and multivalued.

[VBScript]
Const adModeReadWrite       = 3
Const adFailIfNotExists     = -1
Const adCreateNonCollection = 0

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

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

' A urn scheme is used for the namespace.
' This task creates the following properties for the cookbook scenario:
'   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

' Create the property definition in the schema folder for submitdate
Rec.Open strURL & "submitdate",,adModeReadWrite, adCreateNonCollection
Set Flds = Rec.Fields
With Flds
  .Item("DAV:contentclass") = "urn:content-classes:propertydef"
  .Item("urn:schemas-microsoft-com:xml-data#name")  = "urn:schemas-microsoft-com-cookbook:submitdate"
  .Item("urn:schemas-microsoft-com:datatypes#type") = "date"
  .Item("urn:schemas-microsoft-com:exch-data:ismultivalued") = False
  .Item("urn:schemas-microsoft-com:exch-data:isindexed")     = True
  .Item("urn:schemas-microsoft-com:exch-data:isreadonly")    = False
  .Update
End With
Rec.Close

' Create the property definition in the schema folder for cuisine
Rec.Open strURL & "cuisine",,adModeReadWrite, adCreateNonCollection
Set Flds = Rec.Fields
With Flds
  .Item("DAV:contentclass") = "urn:content-classes:propertydef"
  .Item("urn:schemas-microsoft-com:xml-data#name")  = "urn:schemas-microsoft-com-cookbook:cuisine"
  .Item("urn:schemas-microsoft-com:datatypes#type") = "string"
  .Item("urn:schemas-microsoft-com:exch-data:ismultivalued") = False
  .Item("urn:schemas-microsoft-com:exch-data:isindexed")     = True
  .Item("urn:schemas-microsoft-com:exch-data:isreadonly")    = False
  .Update
End With
Rec.Close

' Create the property definition in the schema folder for title
Rec.Open strURL & "title",,adModeReadWrite, adCreateNonCollection
Set Flds = Rec.Fields
With Flds
  .Item("DAV:contentclass") = "urn:content-classes:propertydef"
  .Item("urn:schemas-microsoft-com:xml-data#name")  = "urn:schemas-microsoft-com-cookbook:title"
  .Item("urn:schemas-microsoft-com:datatypes#type") = "string"
  .Item("urn:schemas-microsoft-com:exch-data:ismultivalued") = False
  .Item("urn:schemas-microsoft-com:exch-data:isindexed")     = True
  .Item("urn:schemas-microsoft-com:exch-data:isreadonly")    = False
  .Update
End With
Rec.Close

' Create the property definition in the schema folder for ingredients
Rec.Open strURL & "ingredients",,adModeReadWrite, adCreateNonCollection
Set Flds = Rec.Fields
With Flds
  .Item("DAV:contentclass") = "urn:content-classes:propertydef"
  .Item("urn:schemas-microsoft-com:xml-data#name")  = "urn:schemas-microsoft-com-cookbook:ingredients"
  .Item("urn:schemas-microsoft-com:datatypes#type") = "string"

  ' Note that ismultivalued is set to true for handling multiple ingredients
  .Item("urn:schemas-microsoft-com:exch-data:ismultivalued") = True
  .Item("urn:schemas-microsoft-com:exch-data:isindexed")     = True
  .Item("urn:schemas-microsoft-com:exch-data:isreadonly")    = False
  .Update
End With
Rec.Close

' Create the property definition in the schema folder for instructions
Rec.Open strURL & "instructions",,adModeReadWrite, adCreateNonCollection
Set Flds = Rec.Fields
With Flds
  .Item("DAV:contentclass") = "urn:content-classes:propertydef"
  .Item("urn:schemas-microsoft-com:xml-data#name")  = "urn:schemas-microsoft-com-cookbook:instructions"
  .Item("urn:schemas-microsoft-com:datatypes#type") = "string"

  ' Note that ismultivalued is set to true for handling multiple instructions
  .Item("urn:schemas-microsoft-com:exch-data:ismultivalued") = True
  .Item("urn:schemas-microsoft-com:exch-data:isindexed")     = True
  .Item("urn:schemas-microsoft-com:exch-data:isreadonly")    = False
  .Update
End With
Rec.Close

' Create the property definition in the schema folder for rating
Rec.Open strURL & "rating",,adModeReadWrite, adCreateNonCollection
Set Flds = Rec.Fields
With Flds
  .Item("DAV:contentclass") = "urn:content-classes:propertydef"
  .Item("urn:schemas-microsoft-com:xml-data#name")  = "urn:schemas-microsoft-com-cookbook:rating"
  .Item("urn:schemas-microsoft-com:datatypes#type") = "int"
  .Item("urn:schemas-microsoft-com:exch-data:ismultivalued") = False
  .Item("urn:schemas-microsoft-com:exch-data:isindexed")     = True
  .Item("urn:schemas-microsoft-com:exch-data:isreadonly")    = False
  .Update
End With
Rec.Close