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.

2
  • 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? Commented Dec 25, 2015 at 15:57
  • @ShanthaKumarThambidurai I need to get all the minor versions available for a specific item. Commented Dec 25, 2015 at 16:04

3 Answers 3

4

Use something like this

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

hope this can help you

3
  • If it helps you then mark it as answer Commented Dec 26, 2015 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. Commented Dec 28, 2015 at 9:33
  • 1
    You can loop all the files and get minor files Commented Dec 28, 2015 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.

1
  • Could you please briefly explain how can we do that with Lists.asmx web service? Commented Dec 28, 2015 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.

1
  • Thank you for your suggestion. But I need to use REST API to get these items. Commented Dec 28, 2015 at 9:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.