When we need to update the properties of the large number of documents in Content Engine, Filenet provides the script execution option for bulk updates. The scripts are executed using Filenet Enterprise Manager. This option is provided in the search functionality so that we can search the documents based on conditions and update only those articles. This makes developer or support engineer job is easy. Custom property updates generally doesn't require the checkout and checkin of the documents. We can directly update the properties using the script. We can use the below code to update the property.
CEObject.Properties("DocumentType").Value="Confidential"
CEObject.Save
When I tried the above code to update the mime type property it is not working and I found out that it is a read only property and to update the read only properties like mime type we need to checkout the document and before checkin the document we need to update the property. So I have updated the above scrip as mentioned below.
CEObject.Checkout
CEObject.Reservation.Properties("mimetype").Value= "text/html"
CEObject.Reservation.Save
CEObject.Reservation.Checkin
After executing the above script I have observed that the mime type property updated as expected and document version also upgraded but the content of the document is missing. While checkin the document we need to pass the content otherwise it will save the empty document. So I have written a script to get the document content and saved to the local folder and while check-in the document i have added the content.
The above code is used to checkout the content and saved to the local folder and update the mime type property and checkin the content from local folder.
CEObject.CopyContent "file:///localfoldername/filename"
CEObject.Checkout
CEobject.Reservation.Properties("MimeType")= "text/html"
CEObject.Reservation.Checkin "foldername\filename"
CEObject.Checkout
CEobject.Reservation.Properties("MimeType")= "text/html"
CEObject.Reservation.Checkin "foldername\filename"
The above code is used to checkout the content and saved to the local folder and update the mime type property and checkin the content from local folder.