Need help with CheckInFile web service...

Aug 10, 2012 at 1:17 PM
Edited Aug 10, 2012 at 1:18 PM

Hi,

I've trying out the CheckInFile service, using the following code:

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js" type="text/javascript"></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">
var bookURL = "<url removed>";
var divId = "#WSOutput";

    $().ready(function () {
      $().SPServices({
        operation: "CheckInFile",
        async: false,
        pageUrl: bookURL,
        comment: "This has been checked in using SP Services",
        CheckInType: 1,
        completefunc: function (xData, Status) {
          //$(xData.responseXML).find("errorstring").each(function() {
          //  alert($(this).text() + " Please save all of your changes before attempting to check in the document.");
          //  success = false;
          //});

          var out = $().SPServices.SPDebugXMLHttpResult({
	    node: xData.responseXML,
	    outputId: divId
          });
        }
      });
    });

</script> 

<div id="WSOutput" />

I'm struggling to get it working, and I'm not sure where I've gone wrong - can anyone help please? I had tried originally with the 3 lines currently commented out, before commenting them out and replacing it with a call to just view all of the XML - if I use the first 3 lines, then I always get the error text shown "Input string was not in a correct format...".

I don't know if it is the URL I'm using - I've had to remove it for security, but it is a valid link, although it uses a port number and an encoded space in the URL; this shouldn't affect it, should it?

Thanks,

Alex.

Coordinator
Aug 10, 2012 at 1:53 PM

bookURL should be (I believe) the exact same format that you'd use if you were to go to the document in the browser.

M.

Aug 10, 2012 at 1:59 PM

Mmm - I did check it manually in my browser, and the URL I used was valid; I've not shown it here for security reasons? It's in the format of http://<servername>:<port>/Shared%20Documents/navigator.jpg - am I correct in assuming that this web service should work on any format of document, and not just web pages? I could get the CheckOutFile service working fine using the same URL, so I know the URL is good - just not sure why it's not working when using it with the CheckInFile service...? (I did also try with a proper space in the URL, instead of the (%20) encoding, as well as with and without quotes - this didn't make any difference...)