_PropertyAccessor.SetProperties(Object, Object) Method

Definition

Sets the properties specified by the array SchemaNames to the values specified by the array Values.

public:
 System::Object ^ SetProperties(System::Object ^ SchemaNames, System::Object ^ Values);
public object SetProperties (object SchemaNames, object Values);
Public Function SetProperties (SchemaNames As Object, Values As Object) As Object

Parameters

SchemaNames
Object

An array of names of properties whose values are to be set as specified by the Values parameter. These properties are referenced by namespace. For more information, see Referencing Properties by Namespace

Values
Object

An array of values that are to be set for the properties specified by the SchemaNames parameter.

Returns

An Object that is Nothing (a null reference (Nothing in Visual Basic) in C#) if the operation is successful. If there is an error before any properties are set, for example, the number of elements in the SchemaNames array does not match that in the Values array, and an Err value will be returned. If there is an error during the setting of the properties, the return value is an array of Err objects, with the number of elements in this array being the same as that of the SchemaNames array. An Err value in the array is mapped to the error result of setting the corresponding property in the SchemaNames parameter.

Remarks

If the property does not exist and the SchemaNames element contains a valid property specifier, then SetProperties creates the property and assigns the property with the value specified by Values. The type of the property will be the type of the element passed in Values. If the property does exist, then SetProperties assigns the property the value as specified by Values.

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