UserProperties.Add Method
Outlook Developer Reference |
Creates a new user property in the UserProperties collection.
Syntax
expression.Add(Name, Type, AddToFolderFields, DisplayFormat)
expression A variable that represents an UserProperties object.
Parameters
Name | Required/Optional | Data Type | Description |
---|---|---|---|
Name | Required | String | The name of the property. |
Type | Required | OlUserPropertyType | The type of the new property. |
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 True. |
DisplayFormat | Optional | Long | Specifies how the property will be displayed in the Outlook user interface. This parameter can be set to a value from one of several different enumerations, determined by the OlUserPropertyType constant specified in the Type parameter. For more information on how Type and DisplayFormat interact, see DisplayFormat Property. |
Return Value
A UserProperty object that represents the new property.
Remarks
You can define custom properties for Outlook items by calling either the UserProperties.Add method for an Outlook item or the UserDefinedProperties.Add method for a folder.
You cannot add custom properties to Office document items such as Word, Excel, or PowerPoint files. You will receive an error when you try to programmatically add a user-defined field to a DocumentItem object.
Example
This VBA example creates a new ContactItem object and adds "LastDateSpokenWith" as a custom property.
Visual Basic for Applications |
---|
|
This VBA example creates a new ContactItem object and adds "Details" as a user property. The value is set by changing the Value property of the UserProperty object.
Visual Basic for Applications |
---|
|
See Also