Platform SDK: CDO 1.2.1

Creating Rendering Objects, Formats, and Patterns

The following code shows how to create an ObjectRenderer object for a message. It also adds the following:

' Assume Rendering application is stored in 
' Active Server Pages Application object
Set objRenderApp = Application ("RenderingApp")

' Create a renderer object using class object renderer
Set objRenderer = objRenderApp.CreateRenderer (AMHTML_Class_ObjectRenderer)
If (Not objRenderer Is Nothing) Then

   ' Add a property-only Format object (for PR_IMPORTANCE)
   ' (The named format will contain language specific strings.)
   Set objFormat = objRenderer.Formats.Add(CdoPR_IMPORTANCE, Null)
   objFormat.Patterns.Add "*", "%langImportance%"

   ' Add a named Format object to the renderer object
   Set objFormat = objRenderer.Formats.Add(0, "langImportance")

   ' Add patterns to Format object (possible property 
   ' values and corresponding RenderUsing strings) 
   objFormat.Patterns.Add 0, "Low" 
   objFormat.Patterns.Add 1, "Normal"
   objFormat.Patterns.Add 2, "High"

   ' Add LinkPattern string (creates "message_Link" named format)
   objRenderer.LinkPattern = "%virtroot%/forms/%classpath%frmroot.asp?obj=%obj%&command=open"

   ' Store new renderer object in Session for later use
   Set Session("ObjectRenderer") = objRenderer
End If