Programming Microsoft Outlook and Microsoft Exchange, Second Edition (DV-MPS Programming)

[Previous] [Next]

The Formats collection contains zero or more Format objects that are used to specify how certain properties are rendered. By creating Format objects in the Formats collection, you can create new ways to render your own or built-in properties using the Rendering library.

Formats Collection Methods

The following section describes the Add method of the Formats collection.

Add Method

The Add method is the only method on the Format collection. It creates and returns a new Format object. The Add method has one required parameter and one optional parameter. The required parameter specifies the property tag or the name of a custom property that is to be formatted by the new Format object. The optional parameter is a string that specifies the name to be assigned to the new Format object. It is used only for special-purpose formats. If you do use the optional parameter, the required parameter must be set to 0.

The following example shows you how to create a format for the sensitivity of a message:

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

Formats Collection Properties

The only interesting properties of the Formats collection are the Count and Item properties. The Count property returns the number of Format objects in the collection. The Item property allows you to retrieve a Format object by using the object's index, name, or property tag. The following example uses the Count and Item properties together:

For i = 1 To objFormatsColl.Count Response.write objFormatsColl.Item(i).Name Next

Format Object Methods

The only method on the Format object is the Delete method, which deletes the current Format object from the Formats collection.

Format Object Properties

The following sections describe the properties of the Format object.

Name Property

The Name property returns or sets the reference name for the Format object. This property is available only on special-purpose formats that do not represent specific properties.

Patterns Property

Patterns specify the way CDO should render the property. When you create formats, you must specify patterns for them. The Patterns property can return either a single Pattern object or the Patterns collection. When no parameter is passed to the Patterns property, the property returns the full Patterns collection. If you pass an index to the Patterns property, it will return the corresponding Pattern object.

Property Property

The Property property returns the name or the property tag that corresponds to the Format object.

Категории