To get the latest major version of a document you can use this query: https://skywalker57.sharepoint.com/sites/contosoportal/_api/lists/getbytitle(‘Documents’)/[…]sions?$filter=substringof(%27.0%27,VersionLabel)&$top=1
The VersionLabel is the current version, same information as in UIVersionString. VersionLabel is treated as a String: $filter=substringof(%27.0%27,VersionLabel) means $filter=substringof(‘.0’,VersionLabel)
VersionLabels containing ‘.0’ may be considered major versions. Since versions are ordered decrementally in the resultset, we wil only need the highest: $filter=substringof(%27.0%27,VersionLabel)&$top=1
Archive for the ‘Uncategorized’ Category
Get the latest version of any SharePoint listitem or document with the REST API
Posted by skywalker3171 on October 15, 2022
Posted in Uncategorized | Leave a Comment »