Updates the value of the IImageProperty
.
IImageProperty
; cannot be null
. null
, empty, or longer than 255 characters. null
. 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.
IFileProperty
value to the content of an existing file. FileStream image = new FileStream("C:\\uploads\\image.jpg", FileMode.Open); contentItem.SetImagePropertyValue(imageProperty, "myImage.jpg", image); // The name of the image can be set to a different name from the actual image name, such as, // contentItem.SetImagePropertyValue(imageProperty, "someOtherName.jpg", image); // Checks in the content item to persist the updated ImageProperty value. itemManager.CheckInItem(contentItem, "Check in Comment"); // Retrieves the image, image name, height and width after the item is checked in. Stream retrievedImage = contentItem.GetImagePropertyValue(imageProperty); String retrievedImageName = contentItem.GetImageName(imageProperty); int imageWidth = contentItem.GetImageWidth(imageProperty); int imageHeight = contentItem.GetImageHeight(imageProperty);
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 if the image name is an empty string or longer than 255 characters. |
IContentItem Interface | Plumtree.Remote.PRC.Content.Item Namespace | CheckInItem