Oracle® WebCenter Interaction Development Kit 10.3.3.0.0

IContentItem.SetFilePropertyValue Method 

Updates the value of the IFileProperty.

void SetFilePropertyValue(
   IBaseProperty fileProperty,
   string fileName,
   Stream value
);

Parameters

fileProperty
The IFileProperty; cannot be null.
fileName
The name of the file to be uploaded as the value for the specified file property; cannot be null, empty, or longer than 255 characters.
value
The new value for the property; 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.

Note: To use any file upload/download functionality, including this using method, you must install WSE 2.0 (http://msdn.microsoft.com/webservices/building/wse/).


The code sample below shows how to set the IFileProperty value to the content of an existing file.
FileStream content = new FileStream("C:\\uploads\\fileContent.doc", FileMode.Open);
contentItem.SetFilePropertyValue(fileProperty, "fileContent.doc", content);
// The name of the file can be set to a different file name from the actual file name, such as,
// contentItem.SetFilePropertyValue(fileProperty, "someOtherName.doc", content);
 
// Checks-in the content item to persist the updated FileProperty value.
itemManager.CheckInItem(contentItem, "Check-in Comment");
 
// Retrieves the file content and file name after the item is checked in.
Stream retrievedContent = contentItem.GetFilePropertyValue(fileProperty);
String retrievedFileName = contentItem.GetFileName(fileProperty);

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 if the file name is an empty string or longer than 255 characters.

See Also

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