質問

In this question, it appears there is a "/versions" endpoint for the ListItems REST API.

/_api/lists/getbytitle('ListName')/Items(#)/versions returns a 404 'Not Found' on our SharePoint 2016 On-Premise server.

Is there a Cumulative Update or Feature Pack that introduces this endpoint?

役に立ちましたか?

解決

This API only supports in SharePoint Online, not for on-premises. So, it does not work in SharePoint 2016.

If you want to get version information, you can try to use the SharePoint List web service that exposes Lists.GetVersionCollection Method to return version information for an item in a SharePoint list.

Here is a code demo to retrieve a list item version, it works.

<script type="text/javascript" src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
<script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/jquery.SPServices/0.7.1a/jquery.SPServices-0.7.1a.min.js"></script>
<script type="text/javascript">
$(function(){
                $().SPServices({
                                 operation: "GetVersionCollection",
                                  async: false,
                                  strlistID: "Lists_1",
                                  strlistItemID: 1,
                                  strFieldName: "Title",
                                  completefunc: function (xData, Status) {
                                  console.log(xData);
                                    $(xData.responseText).find("Version").each(function(i) {
                                      console.log("Name: " + $(this).attr("Title") + " Modified: " + $(this).attr("Modified"));
                                    });  
                                  }
                }); 
});
</script>

Refer to my answer in this thread.

Here is a demo to get item field version history from Versions.aspx:

https://social.msdn.microsoft.com/Forums/aspnet/en-US/33f9dc3d-be4d-489c-9f40-34aada8c73a2/any-rest-api-available-for-version-history-of-list-item-fileds?forum=sharepointdevelopment

他のヒント

This will work:

https://{site_url}/_api/web/GetFileByServerRelativeUrl('/sites/siteName/Lists/listName/{itemID}_.000')/Versions
ライセンス: CC-BY-SA帰属
所属していません sharepoint.stackexchange
scroll top