Modifica

Condividi tramite


_PropertyAccessor.SetProperty(String, Object) Method

Definition

Sets the property specified by SchemaName to the value specified by Value.

public:
 void SetProperty(System::String ^ SchemaName, System::Object ^ Value);
public void SetProperty (string SchemaName, object Value);
Public Sub SetProperty (SchemaName As String, Value As Object)

Parameters

SchemaName
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

Value
Object

The value that is to be set for the property specified by SchemaName.

Remarks

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:

For more information on setting properties using the PropertyAccessor object, see Best Practices for Getting and Setting Properties

Applies to