Thursday, November 8, 2012

Remove working copy documents in Alfresco

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");
}

Hope this helps someone.

Enjoying alfresco !
Murali

No comments:

Post a Comment