Creating a Property
Outlook Developer Reference |
Outlook provides several ways to add custom properties:
UserProperties.Add | ItemProperties.Add | PropertyAccessor.SetProperty | PropertyAccessor.SetProperties | |
Action | Adds a custom property specified by Name and Type. If a property of the same name and type already exists, it will be overwritten by a new property. The default value for AddToFolderFields allows adding the property to the item and as a view field to the folder. | Adds a custom property specified by Name and Type even if a property of the same name and type already exists. The default value for AddToFolderFields allows adding the property to to the item and as a view field to the folder. | Adds a custom property specified by SchemaName if the provider and the parent object supports property creation, the property does not already exist, and a valid schema name is specified for the property. | For each property in SchemaNames, PropertyAccessor.SetProperties adds it as a custom property if the provider and the parent object supports property creation, the property does not already exist, and a valid schema name is specified for the property. |
Applicable Objects | All Outlook item objects except Microsoft Office document items (DocumentItem objects) | All Outlook item objects except Microsoft Office document items (DocumentItem objects) | All Outlook item objects including DocumentItem objects. | All Outlook item objects including DocumentItem objects. |
Property Initial Value | Empty in VBA; requires subsequent assignment | Empty in VBA; requires subsequent assignment | Specified by Value. | Specified by the value of the corresponding element in the Values array |
Property Type | Specified by Type | Specified by Type | If the property is specified by the MAPI proptag or id namespace, the property type is contained in the lowest 16 bits of the identifier; otherwise the property type is determined by the type of Value. | Type of each property is determined by the same principles as in the SetProperty column; where the property is not specified by any namespace involving its proptag, its property type is the type of the corresponding element in the Values array. |
Upon Property Change | The CustomPropertyChange event will fire on property change. | The CustomPropertyChange event will fire on property change. | An item-level property added this way does not become part of the item's UserProperties collection. It will not generate Outlook Object Model events when it is changed. | Same event considerations as in the SetProperty column. |
See Also