Retrieve all the Versions of a Particular Document in Alfresco

Use the below code ,to retrieve all the versions of a particular document. 

  1. Dictionary < string, string > parameters = new Dictionary < string, string > ();  
  2. parameters[DotCMIS.SessionParameter.BindingType] = BindingType.AtomPub;  
  3. parameters[DotCMIS.SessionParameter.AtomPubUrl] = "http://localhost:8080/alfresco/service/cmis";  
  4. parameters[DotCMIS.SessionParameter.User] = "admin";  
  5. parameters[DotCMIS.SessionParameter.Password] = "admin";  
  6. SessionFactory factory = SessionFactory.NewInstance();  
  7. ISession session = factory.GetRepositories(parameters)[0].CreateSession();  
  8. IList < IDocument > documents = document.GetAllVersions();  
  9. foreach(Document doc in documents) {  
  10.  Console.WriteLine("Document name : " + doc.Name + " and its version " + doc.VersionLabel);  
  11. }  
Hope this helps someone.