cancel
Showing results for 
Search instead for 
Did you mean: 

Delete document's version

memex
Champ in-the-making
Champ in-the-making
Hello to everyone.
I have Alfresco 4.2.f Community version.
Is there a way to delete a version of my document into Share?
Thanks to all
1 REPLY 1

kavilash23
Champ on-the-rise
Champ on-the-rise
Hi,

The VersionService provides both deleteVersion and deleteVersionHistory.  You can write a java backed webscript or write a custom Java Action that calls such methods.

You can write something like the following in your java class

VersionHistory history = versionService.getVersionHistory(nodeRef);

for (Version version : history.getAllVersions())
{
     if (version.getVersionLabel().equals("3"))
     {
         versionService.deleteVersion(nodeRef, version);
         break;
     }
}

Hope this helps.