Remove working copy documents in Alfresco explorer or
Alfresco Share
Yesterday I've been asked to cancel all the working copy
documents from alfresco sites.
So, I've used JavaScript API to cancel the all the working
copy documents.
Step 1
First get all the node references of the working copy
documents using searchservice.
Step 2
Use the nodeservice to cancel the working copy
document.
var results =
search.selectNodes("workspace://SpacesStore","descendant::*[hasAspect('cm:workingcopy')]");
logger.info("Total
rows" + results.length);
for(var
i=0;i<results.length;i++)
{
var node = results[i];
var nodename =
node.name;
node.cancelCheckout();
logger.error(nodename +
" cancelled");
}