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

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?

0 votes

1 answers

2825 views

ANSWER



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.

0 votes