Sets the property specified by SchemaName to the value specified by Value.
Assembly: Microsoft.Office.Interop.Outlook (in Microsoft.Office.Interop.Outlook.dll)
- Type: System.String
The name of a property whose value is to be set as specified by Value. The property is referenced by namespace. For more information, see Referencing Properties by Namespace.
- Type: System.Object
The value that is to be set for the property specified by SchemaName.
If the property does not exist and the SchemaName contains a valid property specifier, then SetProperty creates the property and assigns the value specified by Value. If the property does exist and SchemaName is valid, then SetProperty assigns the property with the value specified by Value.
Note that a custom property created by using the PropertyAccessor is not supported in a custom view. If you want to view a custom property on an item, create the property by using the Add(String, OlUserPropertyType, Object, Object) method.
If the parent object of the PropertyAccessor supports an explicit Save operation, then the properties should be saved to the object with an explicit Save method call. If the object does not support an explicit Save operation, then the properties are saved to the object when SetProperties is called.
Use caution and ensure that all exceptions are handled correctly. Conditions where setting properties fails include:
The property is read-only, as some Outlook and MAPI properties are read-only.
The property referenced by the specified namespace is not found.
The property is specified in an invalid format and cannot be parsed.
The property does not exist and cannot be created.
The property exists but is passed a value of an incorrect type.
Cannot open the property because the client is offline.
The property is created using the Add method of the UserProperties object. When setting the property for the first time, you must use the Value property of the UserProperty object, instead of the SetProperties(Object, Object) or SetProperty method of the PropertyAccessor object.
For more information on setting properties using the PropertyAccessor object, see Best Practices for Getting and Setting Properties.