RDOUserProperties object

 

RDOUserProperties collection contains custom properties of an Outlook item. Note that this collection is compatible with the UserProperties collection in the Outlook Object Model (see MSDN).

On the MAPI level user property values are stored as regular named MAPI properties, but Outlook also stores the properties definitions in a special binary blob, which in turn is stored in another named MAPI property on the item.

You can access the values of the user properties using MAPIProp.Fields, but RDOUserProperties collection allows to modify the user properties definitions, which are also used when designing a form or when managing folder fields (see RDOFolderFields).

 

Returned by:

RDOMail.UserProperties (and all other objects derived from RDOMail- RDOAppointmentItem, RDOContactItem, RDOTaskItem, etc).

 

 

The example below create a new task and adds a new user property of type olFormula.

set Session = CreateObject("Redemption.RDOSession")
Session.Logon
Set task = Session.GetDefaultFolder(olFolderTasks).Items.add
task.TotalWork = 3000
task.Subject = "Test task with a user property"
Set Prop = task.UserProperties.Add("TotalWork", olFormula)
Prop.Formula = "[Total Work]"
Prop.ValidationFormula = ">= 2400"
Prop.ValidationText = "Total work must be greater than 2400"
task.Save

 

Properties

Methods

 


Derived from: IDispatch


Properties


Count

Returns an integer indicating the count of user properties in the RDOUserProperties collection. Read-only.

 

 

Methods


Add(Name, Type, AddToFolderFields, DisplayFormat)

Creates a new user property in the RDOUserProperties collection. If the property with the same name already exists, it will be returned unless the the old property type is different from the the current type, in which case an error will be raised.

Returns RDOUserProperty object.

 

Name - the name of the property

 

Type - one of the rdoUserPropertyType enums.

 

olText (0x1)
olNumber (0x3)
olDateTime (0x5)
olYesNo (0x6)
olDuration (0x7)
olKeywords (0xB)
olPercent (0xC)
olCurrency (0xE)
olFormula (0x12)
olCombination (0x13)

olInteger (0x14)

 

AddToFolderFields - optional, boolean. True if the property will be added as a custom field to the folder that the item is in. This field can be displayed in the folder's view. False if the property will not be added as a custom field. The default value is False.

 

DisplayFormat, integer, optional. If not specified, defaults to 0.

Used only if AddToFolderFields  parameter (see above) is true.

The meaning and the possible values of the DisplayFormat parameter depend on the value of the Type parameter. This parameter is essentially a zero based index of the entry selected from the "Format" combobox in the "Field Chooser" dialog in Outlook:

 
olText (0x1) 0
olNumber (0x3) 0 - 8
olDateTime (0x5) 0 - 15
olYesNo (0x6) 0 - 3
olDuration (0x7) 0 - 3
olKeywords (0xB) 0
olPercent (0xC) 0 - 3
olCurrency (0xE) 0 - 1
olFormula (0x12) 0
olCombination (0x13) 0

olInteger (0x14)

0 - 3

 

See the example above

 

AddDefaultFormProperties
Previously, RDOUserProperties object opened the MAPI form responsible for the custom message class and read its default properties. RDOItems.Add performed similar steps when a message with a custom class was created. MAPI forms represent a significant performance and stability problem, hence that code was moved to an explicit RDOUserProperties.AddDefaultFormProperties method.

 set Session = CreateObject("Redemption.RDOSession")
Session.MAPIOBJECT = Application.Session.MAPIOBJECT
set Msg = Session.GetDefaultFolder(olFolderDrafts).Items.Add("IPM.Note")
Msg.Subject = "Required property"
Msg.UserProperties.AddDefaultFormProperties
Msg.Save

Find(Name, Custom)

Locates and returns an RDOUserProperty object for the requested user property name, if it exists, or null if it does not.

 

Name - the name of the property.

 

Custom - variant, optional. If TRUE, only custom user properties are searched. If FALSE, built-in Outlook Object Properties (e.g. Subject) are returned. The default value is TRUE.

 

set Session = CreateObject("Redemption.RDOSession")
Session.logon
set msg = Session.GetDefaultFolder(olFolderDrafts).Items.Add
set Prop = msg.UserProperties.Find("Subject", false)
Prop.Value = "New Subject value"
Msg.Save

Item(Index)

Locales and returns an RDOUserProperty object with the specified index (if the Index parameter is an integer) or a name (if the Index parameter is a string).

 

Index - variant. Either a 1 based index of the user property or a string (user property name).

 

 

Remove(Name)

Removes the user property with the specified name from the collection.

 

.Name - the name of the property