User Add(String, OlUserPropertyType, Object, Object) Properties.
Add(String, OlUserPropertyType, Object, Object)
Creates a new user property in the UserProperties collection.
public Microsoft.Office.Interop.Outlook.UserProperty Add (string Name, Microsoft.Office.Interop.Outlook.OlUserPropertyType Type, object AddToFolderFields, object DisplayFormat);
Public Function Add (Name As String, Type As OlUserPropertyType, Optional AddToFolderFields As Object, Optional DisplayFormat As Object) As UserProperty
The name of the property. The maximum length is 64 characters. The characters, '[', ']', '_' and '#', are not permitted in the name.
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 be added as a custom field to the item but not to the folder. The default value is True.
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 property type specified in the
Type parameter. For more information on how
DisplayFormat interact, see DisplayFormat.
You can define custom properties by calling either the UserProperties.Add method for an Outlook item or folder, or the Add(String, OlUserPropertyType, Object, Object) method for a folder.
To set for the first time a property created by the Add method, use the Value property of the UserProperty object instead of the SetProperties(Object, Object) or SetProperty(String, Object) method of the PropertyAccessor object.
If you want to view a custom property on an item, you must use the UserProperties.Add method to create that property. Custom properties created by the PropertyAccessor are not supported in a custom view.
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.