The Patterns collection contains Pattern objects. Pattern objects represent a rendering pattern within a format. The following section describes both the Patterns collection and the Pattern object.
The only method on the Patterns collection is the Add method, which creates and returns a new Pattern object. Th Add method takes two required parameters. The first parameter specifies the property values to be rendered by the new Pattern object. In this parameter, you specify the value that the property must be to match the pattern. The second parameter specifies how the property should be rendered. These two parameters correspond to the Value and RenderUsing properties of the Pattern object. The following example shows the Add method being used:
Set objFormat = objRenderer.Formats.Add(ActMsgPR_SENSITIVITY, Null) Set objPatterns = objFormat.Patterns bstrHTML = bstrImgSrc + _ "/images/private.gif WIDTH=13 HEIGHT=13 BORDER=0>" objPatterns.Add 1, bstrHTML ' personal objPatterns.Add 2, bstrHTML ' private objPatterns.Add 3, bstrHTML ' confidential objPatterns.Add "*", "" ' normal |
The Patterns collection has two properties, Count and Item. The Count property returns the number of Pattern objects in the collection. The Item property allows you to access a specific Pattern object by specifying the index of the Pattern object you want.
The only method on the Pattern object is the Delete method, which deletes the current Pattern object from the collection.
The following sections describe the properties of the Pattern object.
The RenderUsing property returns or sets the string that determines how to render the property specified by the Pattern object. You can use substitution tokens with the RenderUsing property to replace the token with the attribute from the designated property. The following table lists the available substitution tokens:
Substitution Token | Property Rendered |
---|---|
%apptlength% | Returns the number of rows spanned by the appointment or free block on an AppointmentItem object being viewed in CdoModeCalendarDaily view. |
%apptwidth% | Returns the number of columns spanned by the appointment or free block on an AppointmentItem object being viewed in CdoModeCalendarDaily view. |
%classpath% | For a Message object, this token returns the message class of the item. For report message-class objects, only the first and last elements are returned. For example, REPORT.IPM.Note.NDR returns report.ndr. |
%columns% | Returns the total number of columns in the view for an AppointmentItem object being viewed in CdoModeCalendarDaily view. |
%date% | For an AppointmentItem object, returns, as a string, the day for which appointments are being rendered. |
%kvalue% | For a numeric property, returns the size in kilobytes. |
%obj% | Returns the unique identifier for the object as a hexadecimal string. |
%parentobj% | For a message object, this token returns the unique identifier for the parent folder as a hexadecimal string. |
%rowid% | For objects in a calendar or table view, this token returns the position of the object in its containing table. |
%tablewidth% | In a calendar view, this token returns the sum of the pixel widths for all the columns. |
%time% | For an AppointmentItem object in CdoModeCalendarDaily view, this token returns the time of the time slot being rendered. |
%value% | This token returns the value of the property. |
You can use more than one substitution token. The following example shows two substitution tokens being used:
Set objFormat = objRenderer.Formats.Add(ActMsgPR_SENSITIVITY, Null) Set objPatterns = objFormat.Patterns bstrHTML = <a href='message.asp?entryid=%obj%'>%value%</a> objPatterns.Add 1, bstrHTML ' personal objPatterns.Add 2, bstrHTML ' private objPatterns.Add 3, bstrHTML ' confidential objPatterns.Add "*", "" ' normal |
The Value property specifies the property value to render for a pattern. If the value for the property is a string, you can use regular expressions within the string. The regular expressions you can use include the following values:
Regular Expression | Matching Values |
---|---|
* | Zero or more characters |
? | Exactly one character |
[. . .] | A single character matching any character in the brackets |
[x1-x2] | A single character matching any character between characters x1 and x2 inclusive. |