Hi Team,
I have created one document(test.txt) as cm:content type via share UI.
I have changed its type to one of the custom type "dc:whitePaper" using change type action on document details page.
Now, i want to convert the document to cm:content type via javascript.
I have written below js code for this.
var query = '(TYPE:"dc:whitePaper")';
var queryDef = {query: query, store: "workspace://SpacesStore", language: "fts-alfresco", page: {maxItems: 200000, skipCount: 0}};
var results = search.query(queryDef);
logger.log(results.length);
for each(var document in results) {
logger.log(document.properties.name);
logger.log(document.type);
logger.log(document.typeShort);
if(document.type == "{http://www.democo.com/model/document/1.0}whitePaper")
{
document.typeShort = "cm:content";
logger.log("after "+document.typeShort);
document.save();
logger.log("saved");
}
}I didn't find any API for javascript that can change the content type of the document.
If javascript doesn't provide this API, can we do it via java based webscript?
Any other suggestions please.
Thanks in advance!