문제

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