Change the MIME Type of a vRO Resource Element

When a file is imported into vRO to be used as a Resource Element, a MIME type is automatically set depending on what has been imported. For instance, in the below example a shell script has been imported, the contents of which will be used as part of some vRO automation - notice the MIME type has been set to application/x-sh.

This doesn’t really cause a problem in itself when using the Resource Element in a workflow, however vRO doesn’t display the content of all MIME types when looking at the file in the Viewer tab and may display the message “cannot display this kind of element” instead - *.sh is one of those :

 

 

It is possible to change the MIME type of an existing Resource Element with the following code:

Drop that into a workflow and you can use it like this - supply inputs for which Resource Element and what MIME type to change it to. In this example we’ll use text/plain:

Upon successful completion of the workflow, the type should have changed:

and now the contents are viewable on the Viewer tab: