1

I am able to upload a file to SharePoint folder through a shiny app from a Rshiny server. However, I am not able to check in the file. Any advice please? I am not able to implement the suggestion provided here [https://stackoverflow.com/questions/28341625/performing-multiple-requests-using-curl-with-different-options]. I am not able to dynamically update the node element value for the pageURL in the XML file.

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <CheckInFile xmlns="http://schemas.microsoft.com/sharepoint/soap/">
      <pageUrl>https://mysharepointserver.com/sites/mysite/myfile.txt</pageUrl>
      <comment>Automagic update</comment>
      <checkinType>0</checkinType>
    </CheckInFile>
  </soap:Body>
</soap:Envelope>
1

Solution using R:

library(XML)
#put above xml in test.xml and pass on the path of this file to below xmlParseDoc()
xml_doc = xmlParseDoc("test.xml") 
invisible(replaceNodes(getNodeSet(xml_doc, "//ns:CheckInFile//ns:pageUrl/text()", c(ns="http://schemas.microsoft.com/sharepoint/soap/"))[[1]], newXMLTextNode("YournewPageUrl")))
xml_doc
  • This works like a charm. However, end of the day I am not able to CheckInFile in the SharePoint after uploading it. the curl commands runs without throwing an error and that's it. I am saving the relevant xml file as out.xml and tried the following in vain. curl --ntlm --user usrname:pwd -d @out.xml -H "SOAPAction: schemas.microsoft.com/sharepoint/soap/CheckInFile" -H "Content-Type: text/xml; charset=utf-8" somesite.com/sites/site/Documents/folderX/filename.ext -k – RanonKahn Sep 7 '17 at 15:57
  • And also this: curl --ntlm --user usrname:pwd -d @out.xml -H "SOAPAction: schemas.microsoft.com/sharepoint/soap/CheckInFile" -H "Content-Type: text/xml; charset=utf-8" somesite.com/sites/site/Documents/folderX/_vti_bin/Lists.asmx What am I muissing? – RanonKahn Sep 7 '17 at 15:58

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.