GetVersions Method

Apr 3, 2013 at 11:04 PM
Hi ,

I am using GetVersions method in sharepoint 2010 to get the current page version history.
var url =window.location;

$().SPServices({
operation: "GetVersions",
fileName: url,
completefunc: function (xData, Status) {
    // Do other stuff...
    alert(Status); 
For some pages Status alert is showing success and for some pages alert message is showing as error.

error message "Value Cannot be null"

Let me know if I am missing something.

Thanks in Advance,
Satish
Coordinator
Apr 4, 2013 at 2:45 AM
Satish:

Status will just let you know if the call itself worked, i.e., there was a reply. You'll have to look at xData to see what the returned data is and whether there are issues. Try alerting (or better, inspecting with Firebug) xData.responseText.

M.
Apr 4, 2013 at 4:37 PM
Hi,

When I tried to alert the xData.responseText or xData.responseXML.xml. I am getting the below error.

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
  <soap:Fault>
     <faultcode>soap:Server</faultcode>
     <faultstring>Exception of type 'Microsoft.SharePoint.SoapServer.SoapServerException' was thrown.</faultstring>
     <detail>
        <errorstring xmlns="http://schemas.microsoft.com/sharepoint/soap/">Value cannot be null.</errorstring>
     </detail>
  </soap:Fault>
</soap:Body>
</soap:Envelope>


In GetVersions method for Filename :url( I am passing the current page) .Its works good for some pages and for some pages its showing the above error.

Thanks,
Satish
Coordinator
Apr 4, 2013 at 4:50 PM
I just ran this interactivel on several pages, and I don't get errors. I've also checked in Fribug and I see valid results. (I did this on WSS 3.0 because I had a window open already.)
$().SPServices({
  operation: "GetVersions",
  fileName: window.location,
  completefunc: function (xData, Status) {
    // Do other stuff...
    alert(Status);
  }
});
What's the difference between the pages where it works and where it doesn't? Location? Query string values?

M.
Apr 4, 2013 at 5:17 PM
No query string values.
Same location.
Coordinator
Apr 4, 2013 at 6:08 PM
Edited Apr 4, 2013 at 6:08 PM
That doesn't help much. What else is different? Can you give some examples?

M.
Apr 4, 2013 at 6:56 PM
This is my code and scenerio:

$().SPServices({
operation: "GetVersions",
fileName: url,
listName: "Pages",
completefunc: function (xData, Status) {
    // Do other stuff...
    alert(Status);    
    //alert(xData.responseText);
    //alert(xData.responseXML.xml);
(Not working)

http://DomainName/subsite/subsite/Pages/default.aspx

(Working)
http://DomainName/subsite/subsite/Pages/cobra_premiums.aspx

Thanks,
Coordinator
Apr 4, 2013 at 7:25 PM
Note that listName isn't an option for GetVersions, so you should remove it.

Are the permissions different for those two pages?

All I'm going to be able to help you with are these sorts of questions, as what you are doing ought to work.

M.
Apr 4, 2013 at 7:40 PM
Edited Apr 4, 2013 at 9:00 PM
I removed the list name in the method and permissions are same for both the pages.
But no luck..!