SharePoint 2013 - Get SPListItem versions via REST -


i have sharepoint 2013 list versioning enabled. need to splistitem versions list via rest. can splistitem request: http://spbreportportal/projects/_api/lists/getbytitle('projects')/items(1) can't find in documentation , in response how retrieve versions of item. possible?

it not seem possible versions list item via rest/csom apis, there alternative options

using versions.aspx application page

the idea perform request versions page: http://<server>/<site>/_layouts/versions.aspx?list={litsid}&id=<itemid>

function getitemversions(url,listid,itemid,success) {    var versionsurl = url + '/_layouts/versions.aspx?list=' + listid + '&id=' + itemid;      $.get( versionsurl, function( data ) {       var versionentries = parseversionlist(data);       success(versionentries);    }); }   function parseversionlist(data){    var entries = {};    var versionlist = $(data).find('table.ms-settingsframe');      versionlist.find('tbody > tr').each(function(i){      if(i > 0 && (i-1) % 2 == 0) {         var verrow = $(this); //get version row         var propsrow = verrow.next(); //get properties row         var versionlabel = verrow.find('td:first').html().trim();         entries[versionlabel] = {};         //extract item properties propsrow goes here         //...      }     });       return entries; }   //usage var weburl = _sppagecontextinfo.webabsoluteurl; var listid = _sppagecontextinfo.pagelistid; var listitemid = 1; getitemversions(weburl,listid,listitemid,function(versionentries){   console.log(versionentries); }); 

using lists sharepoint web services

another option utilize lists sharepoint web services exposes lists.getversioncollection method return version information specified field in sharepoint list

spservices example:

$().spservices({   operation: "getversioncollection",   async: false,   strlistid: "projects",   strlistitemid: 1,   strfieldname: "description",   completefunc: function (xdata, status) {     $(xdata.responsetext).find("version").each(function(i) {       console.log("name: " + $(this).attr("description") + " modified: " + $(this).attr("modified"));     });     } });  

Comments

Popular posts from this blog

google api - Incomplete response from Gmail API threads.list -

Installing Android SQLite Asset Helper -

Qt Creator - Searching files with Locator including folder -