Automation Client - retrieve document versions

Hi@all :)

I'm creating/updating documents remotely on a Nuxeo repository using Automation Client (I'm using Nuxeo 5.6). How can i find the versions of a document using Automation Client? And how can i retrieve the content of a specific version of a document?

0 votes

1 answers

2031 views

ANSWER



Hi!

There is no automation operation that get versions of one document (maybe it should). Anyway, you can get away with a run script operation

Here is an example of script that get all published versions of a document (proxies) and remove them :

proxies = Session.getProxies(new org.nuxeo.ecm.core.api.IdRef(Document.id),null);
for(proxy : proxies)
{ Session.removeDocument(proxy.getRef()); }

In your case, you are not looking for proxies but versions, so it should be something like : version = Session.GetVersions(….

For more informations of what methods are available with the object Session, you can take a look at: CoreSession You will see that they are several methods to get the versions of a document depending on what you plan to do with it (just need the refs or all document models).

Fred

0 votes