4

May I know how can one use SPServices to retrieve all the version history of a particular items in a SharePoint 2007 Server List? (If it is not possible via SPServices, are there other Javascript plugins similar to SPServices, that can retrieve all the version history?)

UPDATE 1:

$().SPServices({
  debug: true,
  operation: "GetVersions",
  async: false,
  listName: "System1",
  completefunc: function (xData, Status) {
    $(xData.responseXML).find("[nodeName='z:\\row']").each(function() {
        alert($(this).attr("ows_ID"));
    });
  }
});

2 Answers 2

6

I believe that you are looking for this:

$().SPServices({
  operation: "GetVersionCollection",
  async: false,
  strlistID: "tester",
  strlistItemID: 1,
  strFieldName: "Information",
  completefunc: function (xData, Status) {
    $(xData.responseText).find("Version").each(function(i) {
      console.log("Name: " + $(this).attr("Information") + " Modified: " + $(this).attr("Modified"));
    });  
  }
});

Just replace the word "tester" with the name of your List. Also replace the word "Information" with the name of your column (header).

Further details can be found in here - http://spservices.codeplex.com/discussions/284298

1
  • This is brilliant. Hooking this up to a multi line text (append) field in list view on hover to show all history Nov 20, 2014 at 22:51
4

You should be able to get all of the versions of an item by calling the Versions Web Service with SPServices.

5
  • Hi Marc, do you have a sample code of SPServices retrieve a version history of a item in a SharePoint List 2007? Nov 18, 2011 at 7:38
  • There are plenty of examples on the SPServices site that show how to use the Web Services and process the results. Nov 19, 2011 at 14:35
  • Hi Marc, I tried and added the code inside my question under 'Update 1' but could not get the web site to display the version history of my items in my SharePoint List called - System1. Any insight? Nov 21, 2011 at 9:14
  • You're not looking for the right node. If you look at the SDK for that operation (link above), you'll see that the result isn't z:rows, but results. Nov 23, 2011 at 23:27
  • 1
    Thanks Marc, I think your GetVersionCollection written by you and discussed with LarryMorries (spservices.codeplex.com/discussions/284298) is the one that I find useful and quite close (even though I have to specific which ID of the rows I want to retrieve the version history) Jan 5, 2012 at 8:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.