AquaLogic Interaction Development Kit (IDK) 6.0.0

IContentItem.SetSelectionListPropertyValue Method 

Updates the value of the ISelectionListProperty.

void SetSelectionListPropertyValue(
   IBaseProperty selectionListProperty,
   string selectionListValue
);

Parameters

selectionListProperty
The ISelectionListProperty; cannot be null.
selectionListValue
The new value for the property which is an existing value in the selection list associated with the ISelectionListProperty; cannot be null, an empty string, or longer than 255 characters.

Remarks

The new value should be an existing string value in the selection list associated with the ISelectionListProperty otherwise an ArgumentException will be thrown when the content item is checked in.

An InvalidOperationException will be thrown if this method is called on an item that is not checked out. The updated property value will not be persisted until IContentItemManager.CheckInItem is called. If the content item does not contain the specified property, an ArgumentException will be thrown when IContentItemManager.CheckInItem is called.


The code sample below shows how to create an ISelectionList, create an ISelectionListProperty using that Selection List, and set the value for the ISelectionListProperty.
// Create and store a selection list with a list of string values.
String[] listValues = { "value1", "value2", "value3", "value4", "value5" };
ISelectionList selectionList = selectionListManager.CreateSelectionList(folder, "My Selection List", listValues);
selectionList.Store();
 
// Create a Selection List Property and add to an existing Data Entry Template.
ISelectionListProperty selectionListProp = propertyManager.CreateSelectionListProperty("Selection List Property", "Description for Selection List Property", selectionList);
dataEntryTemplate.AddProperty(selectionListProp);
dataEntryTemplate.Store();
 
// Set the Selection List Property value on a Content item, assuming the Content item
// is created using the above Data Entry Template that has the Selection List Property.
contentItemManager.CheckOutItem(contentItem);
contentItem.SetSelectionListPropertyValue(selectionListProp, "value2");
 
// When setting a selection list value, the string must match exactly
// one of the values in the selection list.
 
// Check in the Content item to persist the updated Selection List property value.
contentItemManager.CheckInItem(contentItem, "Check in the item with Selection List Property value updated.");
 
// Retrieves the value after the item is checked-in.
String retrievedValue = contentItem.GetSelectionListPropertyValue(selectionListProperty);

Also see the code sample in IContentItem for an example of how to modify a property value of different types.

Exceptions

Exception Type Condition
InvalidOperationException The item has already been removed or the item is not checked out.
ArgumentException The item does not contain the specified property or the value is an empty string or longer than 255 characters.

See Also

IContentItem Interface | Plumtree.Remote.PRC.Content.Item Namespace | CheckInItem