Update Mimetype from Unknown to text/plain

cancel
Showing results for 
Search instead for 
Did you mean: 
rjgowrishankar
Member II

Update Mimetype from Unknown to text/plain

Hi All,

Please help in providing the steps to covert all unknown Mimetype documents to text/plain.   I did the following steps but it is not getting updated.  Please help if i am missing anything.

6 Replies
afaust
Master

Re: Update Mimetype from Unknown to text/plain

You cannot use a rule to set the CMIS contentStreamMimetype pseudo property. This property does not actually exist - it has only been defined to support the CMIS interface integration. Instead of using the "Set property value" action you should use the "Change/Set mimetype" action instead.

Also note that for *.msg files the mimetype text/plain is certainly not the correct mimetype, and Alfresco will not be able to properly display such emails nor index them correctly.

rjgowrishankar
Member II

Re: Update Mimetype from Unknown to text/plain

Hi Axel,

Thanks for your reply, but unable to find such a option "Change/Set Mimetype" action.  I am able to see only the below options.  Please suggest if we need to activate anything to get this option.

 

Continued

 

afaust
Master

Re: Update Mimetype from Unknown to text/plain

Hmm... Maybe my memory was incorrect and such an action does not exist out-of-the-box. In that case you would have to create a small JavaScript file in Data Dictionary -> Scripts to set the mimetype which you can then use via the "Execute script" action.

rjgowrishankar
Member II

Re: Update Mimetype from Unknown to text/plain

Sure will try that, I have not created any script till now.

Can you please guide me with the exact parameter which is related to Mimetype, will try updating it.  Thanks in advance.

afaust
Master

Re: Update Mimetype from Unknown to text/plain

Check ScriptNode API for details. The simplest possible script would just be a single line:

document.properties.content.mimetype = 'text/plain';

4535992
Senior Member

Re: Update Mimetype from Unknown to text/plain

There is a java code alternative for this ?

I have tried this:

FormData data = new FormData();
data.addFieldData("prop_mimetype", mimetype, true); Item itemMimetype = new Item("node", nodeRef.toString()); NodeRef nodeRefFoundedUpdated = (NodeRef)formService.saveForm(itemMimetype, data);

and this:

ContentWriter contentWriter = contentService.getWriter(nodeRef, ContentModel.PROP_CONTENT, true);
if(contentWriter != null) {
	contentWriter.setMimetype(mimetype);
}

but is not working is still a "application/octet-stream" value on alfresco share