Alfresco CMIS : Retrieve all the versions of a particular document

Use the below code ,to retrieve all the versions of a particular document.
 Dictionary<string, string> parameters = new Dictionary<string, string>();
 parameters[DotCMIS.SessionParameter.BindingType] = BindingType.AtomPub;
 parameters[DotCMIS.SessionParameter.AtomPubUrl] = "http://localhost:8080/alfresco/service/cmis";
 parameters[DotCMIS.SessionParameter.User] = "admin";
 parameters[DotCMIS.SessionParameter.Password] = "admin";
 SessionFactory factory = SessionFactory.NewInstance();
 ISession session = factory.GetRepositories(parameters)[0].CreateSession();
 // get the document using its noderef
 Document document = ((Document)session.GetObject("workspace://SpacesStore/b49fb618-76a1-4f19-91ac-37c8c39a2412"));
 IList<IDocument> documents = document.GetAllVersions();
 
foreach(Document doc in documents )
{
        Console.WriteLine("Document name : " + doc.Name + " and its version " + doc.VersionLabel);
}
Ebook Download
View all
Learn
View all