7

I have a requirement to get all minor versions of documents in document libraries and list items in lists within a specific SharePoint site(SPWeb). To simplyfy the solution, first I obtained all the items within a SharePoint site using the following REST Search API query.

https://mysharepointserver/sites/mysite/_api/search/postquery

Query Text : 'ContentClass:STS_ListItem'

So it returned all the items within my site. Now I need to get only the minor versions of this items. How should I update my query to get that information? Any suggestions would be highly appreciated.

  • 1
    Can you please elaborate the minor versions? Do you need to get only specified minor version of the item / document or all minor versions of the item? – Shantha Kumar Thambidurai Dec 25 '15 at 15:57
  • @ShanthaKumarThambidurai I need to get all the minor versions available for a specific item. – Jake Dec 25 '15 at 16:04
4

Use something like this

http://<serverURL>/_api/web/getfolderbyserverrelativeurl('/Shared%20Documents/FolderA')/files(‘filename’)/minorversion

hope this can help you

  • If it helps you then mark it as answer – Milind Dec 26 '15 at 10:14
  • Thank you for the answer Milind. But this only returns the minor version number of a specific file. What I need is to get all the minor versions of items within a specific site. – Jake Dec 28 '15 at 9:33
  • 1
    You can loop all the files and get minor files – Milind Dec 28 '15 at 14:47
2

At present, it seems impossible to obtain the version collection of a file or list item using Rest API. This can be achievable through SPListItem.Versions from Server code or Lists.asmx web service from client side. If you need more information, please let me know.

  • Could you please briefly explain how can we do that with Lists.asmx web service? – Jake Dec 28 '15 at 17:33
1

The latest version on the SharePoint Online CSOM (16.1.4727.1200) allows the reading of older versions of documents:

https://dev.office.com/blogs/new-sharepoint-csom-version-released-for-Office-365

I don't have an example to hand, just saying that the API does now support it.

  • Thank you for your suggestion. But I need to use REST API to get these items. – Jake Dec 28 '15 at 9:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.