cancel
Showing results for 
Search instead for 
Did you mean: 

How can I retrieve all or specific version of a particular document?

eric_
Champ in-the-making
Champ in-the-making

I am using nuxeo automation client API to retrieve the list of documents. Document.Query always return the latest version of the document.

How can I retrieve all or specific version of a particular document?

1 REPLY 1

simpoir_
Champ on-the-rise
Champ on-the-rise

using a Context.RunScript operation quickly comes to my mind. I'm not sure if it's "the way" but something in those lines should work to get versions of the current doc.

  <operation id="Context.RunScript">
    <param name="script" type="string">
      versions = Document.getSession().getVersions(Document.getDoc().getRef());
      Context.put("list_of_versions", versions);
    </param>
  </operation>

then you would access in further operations using the <param ...>expr:@{list_of_versions}</param> syntax. There is also the getDocumentWithVersion() method on CoreSession if you know which version you want.