Add Method (UserProperties Collection)

Applies To

UserProperties collection object.

Description

Creates a new user property in the UserProperties collection, and returns the new property as a UserProperty object.

Syntax

expression.Add(Name, Type, AddToFolderFields, DisplayFormat)

expression An expression that returns a UserProperties object.

Name Required String. The name of the property.

Type Required Long. The type of the property. Can be one of the following OlUserPropertyType constants: olCombination, olCurrency, olDateTime, olDuration, olFormula, olKeywords, olNumber, olPercent, olText, or olYesNo.

AddToFolderFields Optional Boolean. True if the property will be added to the folder fields, False if not. The default value is True.

DisplayFormat Optional Long. The index of the format of the specified OlUserPropertyType constant. For more information, see the "Remarks" section.

Remarks

To look up the index of a format to specify for the DisplayFormat argument, follow these steps:

  1. Open a new item.
  2. On the Tools menu, click Design Outlook Form.
  3. Click an empty page, and then click the Field Chooser button on the Supernote toolbar.
  4. In the Field Chooser, click the New button.
  5. In the New Field dialog box, select the appropriate field type in the Type box, and then find the format you want in the Format box. The index of the format corresponds to its position in this list.
Example

This example creates a new ContactItem object and adds "LastDateSpokenWith" as a user property.

Set myItem = myOlApp.CreateItem(olContactItem)
Set myUserProperty = myItem.UserProperties _
    .Add("LastDateSpokenWith", olDateTime)