0

Is there any client side API available (e.g. -CSOM or Rest) to capture version for a document in SharePoint Online ?

Samik Roy
  • 9
  • 4
  • Hi @Samik, Though I didn't tried this but Pz look into this: http://yadavnitinkumar.blogspot.in/2014/12/adding-new-version-in-version.html. – Anupam Sharma Jul 22 '15 at 06:51

1 Answers1

0

You can pull the file versions out using CSOM by asking for the file and its versions. This example pulls the versions out for all files in a given list, but if you have the file reference, you would only need to load its Versions property.

var collection = list.GetItems(CamlQuery.CreateAllItemsQuery());
clientContext.Load(collection, items => items.Include(
    i => i.File,
    i => i.File.Versions));
clientContext.ExecuteQuery();

var item = collection.Single();

foreach (var version in item.File.Versions)
{
    // Do work here
}
Zach
  • 174
  • 2
  • 7