Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Adobe Summit 2023 [19th to 23rd March, Las Vegas and Virtual] | Complete AEM Session & Lab list

How to get the Version History of a stored document?


Level 2


I am trying to store and retrieve the content using Content Services features of ADEP 10.0.

I am able to store and retrieve content where as I am not able to get the version of the document. I am trying to store same or different document, but I donot get the version history or version label. Please guide me how I can get  the version of a stored document.

Also, please advise me if there are simple alternative to do the same in ADEP10.

Please see below my sample code below:

package test.sample;

import java.util.*;

import com.adobe.idp.Document;
import com.adobe.idp.dsc.clientsdk.ServiceClientFactory;
import com.adobe.idp.dsc.clientsdk.ServiceClientFactoryProperties;
import com.adobe.livecycle.contentservices.client.CRCResult;
import com.adobe.livecycle.contentservices.client.impl.DocumentManagementServiceClientImpl;
import com.adobe.livecycle.contentservices.client.impl.UpdateVersionType;

public class AddContent {

    public static void main(String[] args) {
            //Set connection properties required to invoke Document Services in EJB mode                                
            Properties connectionProps = new Properties();
            connectionProps.setProperty(ServiceClientFactoryProperties.DSC_DEFAULT_EJB_ENDPOINT, "jnp://localhost:1099");
            connectionProps.setProperty(ServiceClientFactoryProperties.DSC_SERVER_TYPE, "JBoss");
            connectionProps.setProperty(ServiceClientFactoryProperties.DSC_CREDENTIAL_USERNAME, "administrator");
            connectionProps.setProperty(ServiceClientFactoryProperties.DSC_CREDENTIAL_PASSWORD, "password");
            //Create a ServiceClientFactory object
            ServiceClientFactory myFactory = ServiceClientFactory.createInstance(connectionProps);

            //Create a DocumentManagementServiceClientImpl object
            DocumentManagementServiceClientImpl    docManager = new DocumentManagementServiceClientImpl(myFactory);
            //Specify the store and node name
            String storeName ="SpacesStore"; 
            String nodeName = "/Company Home/Test Directory";
            //Retrieve the document to store in /Company Home/Test Directory
            Document contentA =  new Document(new File("C://Adobe/New files/Data-A.pdf"), false);
            Document contentB =  new Document(new File("C://Adobe/New files/Data-B.txt"), false);
            Document contentC =  new Document(new File("C://Adobe/New files/Data-C.xlsx"), false);
            //Create a MAP instance to store attributes
            Map<String,Object> inputs = new HashMap<String,Object>();
            //Specify attributes that belong to the new content
            String creator = "{}creator";
            String description = "{}description"; 
            inputs.put(creator,"Veeraganteppa Sajjan");
            inputs.put(description,"A sample application form");
            //Store MortgageForm.pdf in /Company Home/Test Directory
            CRCResult resultA = docManager.storeContent(storeName, 
            CRCResult resultB = docManager.storeContent(storeName, 
            CRCResult resultC = docManager.storeContent(storeName, 
            //Get the identifier value of the new resource
            String idA = resultA.getNodeUuid();
            String idB = resultB.getNodeUuid();
            String idC = resultC.getNodeUuid();
            System.out.println("A -The identifier value of the new content is "+idA);
            System.out.println("B - The identifier value of the new content is "+idB);
            System.out.println("C - The identifier value of the new content is "+idC);
           System.out.println("A - The Browse Link is "+resultA.getBrowseLink());
            System.out.println("B - The Browse Link is "+resultB.getBrowseLink());
            System.out.println("C - The Browse Link is "+resultC.getBrowseLink());
          System.out.println("A-The Version Label is "+resultA.getVersionLabel());
          System.out.println("B-The Version Label is "+resultB.getVersionLabel());
          System.out.println("C-The Version Label is "+resultC.getVersionLabel());
          System.out.println("The Version History is "+docManager.getVersionHistory(storeName,nodeName, true));
    }catch(Exception e)

Message was edited by: V B Sajjan

3 Replies


Level 2

Sorry I did not attach the output and errors. Please find the same below.

A -The identifier value of the new content is f5427f5b-c7c1-4c3c-b959-cb84e4e49a13

B - The identifier value of the new content is b237d22c-5ff5-4628-a83a-23f5e49ae48e

C - The identifier value of the new content is 34a9992c-3705-4488-bb55-6dd7ddfa0517

A - The Browse Link is http://localhost:8080/contentspace/wcs/api/node/content/workspace/SpacesStore/f5427f5b-c7c1-4c3c-b95...

B - The Browse Link is http://localhost:8080/contentspace/wcs/api/node/content/workspace/SpacesStore/b237d22c-5ff5-4628-a83...

C - The Browse Link is http://localhost:8080/contentspace/wcs/api/node/content/workspace/SpacesStore/34a9992c-3705-4488-bb5...

A-The Version Label is null

B-The Version Label is null

C-The Version Label is null

ALC-CSV-30015-000: com.adobe.livecycle.contentservices.client.exceptions.CSInvocationException: ALC-CSV-030-015-The node [/Company Home/Test Directory] is not versioned.

at com.adobe.contentservices.webscripts.impl.AbstractContentManager.doGetVersionHistory(

at com.adobe.contentservices.webscripts.impl.ContentManagerImpl.executeParams(

at com.adobe.contentservices.webscripts.impl.CSRetryingTransactionCallback.execute(

at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(

at com.adobe.contentservices.webscripts.impl.ContentManagerImpl.execute(

at org.alfresco.repo.web.scripts.RepositoryContainer$2.execute(

at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(

at org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecute(

at org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecuteAs(

at org.alfresco.repo.web.scripts.RepositoryContainer.executeScript(

at org.alfresco.web.scripts.AbstractRuntime.executeScript(

at org.alfresco.web.scripts.AbstractRuntime.executeScript(

at org.alfresco.web.scripts.servlet.WebScriptServlet.service(

at javax.servlet.http.HttpServlet.service(

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(

at org.apache.catalina.core.ApplicationFilterChain.doFilter(


at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(

at org.apache.catalina.core.ApplicationFilterChain.doFilter(

at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(

at org.apache.catalina.core.ApplicationFilterChain.doFilter(

at org.apache.catalina.core.StandardWrapperValve.invoke(

at org.apache.catalina.core.StandardContextValve.invoke(





at org.apache.catalina.core.StandardHostValve.invoke(

at org.apache.catalina.valves.ErrorReportValve.invoke(

at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(

at org.apache.catalina.core.StandardEngineValve.invoke(

at org.apache.catalina.connector.CoyoteAdapter.service(

at org.apache.coyote.http11.Http11Processor.process(

at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(




Not applicable

Here are a few points for your consideration : -

  1. Please note that  there are two ways of creating versions in Content Services (a) by using storeContent API and passing "Version Type parameter as Major or Minor as you have done. But in addtion to this, you also need to pass Aspect Versionable. The second last parameter is null here.  

List<String> aspectList = new ArrayList<String>();


"{}versionable");  Passing this aspect will make sure that versionable node is created. But in this way, you may not be able to set your own version labels.

  b) An alternative is to use checkout, checkin APIs where you could set your own versions.

  After using either of these methods, the node wil be versionable and its version information can be obtained using the versionhistory API

  2.  To retrieve the actual content corresponding to node version, you need to use retrieveContent API.  Here you will need to supply the required versionLabel for which details are required.

Please feel free to revert back in case of any doubts.



The ultimate experience is back.

Join us in Vegas to build skills, learn from the world's top brands, and be inspired.

Register Now