UserProperties.Add Method

Creates a new user property in the UserProperties collection.

Namespace:  Microsoft.Office.Interop.Outlook
Assembly:  Microsoft.Office.Interop.Outlook (in Microsoft.Office.Interop.Outlook.dll)

Syntax

'Declaration
Function Add ( _
    Name As String, _
    Type As OlUserPropertyType, _
    AddToFolderFields As Object, _
    DisplayFormat As Object _
) As UserProperty
'Usage
Dim instance As UserProperties
Dim Name As String
Dim Type As OlUserPropertyType
Dim AddToFolderFields As Object
Dim DisplayFormat As Object
Dim returnValue As UserProperty

returnValue = instance.Add(Name, Type, _
    AddToFolderFields, DisplayFormat)
UserProperty Add(
    string Name,
    OlUserPropertyType Type,
    Object AddToFolderFields,
    Object DisplayFormat
)

Parameters

  • AddToFolderFields
    Type: System.Object
    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
    Type: System.Object
    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.

Return Value

Type: Microsoft.Office.Interop.Outlook.UserProperty
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.

See Also

Reference

UserProperties Interface

UserProperties Members

Microsoft.Office.Interop.Outlook Namespace