Plumtree EDK (Enterprise Web Development Kit) 5.4.0 |

# IContentItem.SetItemReferencePropertyValue Method

Updates the value of the `IItemReferenceProperty`.

void SetItemReferencePropertyValue(
IBaseProperty itemRefProperty,
IContentItem contentItem
);

#### Parameters

itemRefProperty
  The `IItemReferenceProperty`; cannot be `null`.
contentItem
  The content item to create a reference to; cannot be `null`.

#### Remarks

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 retrieve an existing content item by name and set the value of an `IItemReferenceProperty` to the retrieved content item.

    // Set the ItemReferenceProperty value to another existing Content item,
    // assuming there is another content item named "News" in the specified folder.
    IContentItem newsItem = contentItemManager.GetContentItem(folder, "News");
    contentItemManager.CheckOutItem(contentItem);
    contentItem.SetItemReferencePropertyValue(itemReferenceProperty, newsItem);

    // Check-in the Content item to persist the updated Item Reference property value.
    contentItemManager.CheckInItem(contentItem, "Check-in the item with Item Reference Property value updated.");

    // Retrieves the value after the item is checked-in.
    IContentItem retrievedItemRefPropValue = contentItem.GetItemReferencePropertyValue(itemReferenceProperty);

See code sample in IContentItem class documentation on how to modify 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.

#### See Also

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