如何从共享点文档库使用curl签出文件? [英] How to check-out a file from sharepoint document library using curl?

查看:184
本文介绍了如何从共享点文档库使用curl签出文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可以使用curl使用以下命令将文件签入到共享点文档库:这个问题

It is possible to checkin a file to sharepoint document library using curl with the following command as mentioned in this question :

curl --ntlm --user username:password --upload-file file.txt https://mysharepointserver.com/sites/mysite/myfile.txt -k

但是如何从文档库首先检出文件(使用curl)?

But how to checkout the file first(using curl) from the document library?

我通过传递SOAPAction checkoutfile头和数据,尝试了一个方法,但是它没有任何效果,即使服务器返回了响应:'200 OK'

I tried one method by passing SOAPAction checkoutfile headers and data as follows, but it had no effect eventhough the server returned response: '200 OK'

curl --ntlm --user username:password -d @soapdata.xml -H "SOAPAction: http://schemas.microsoft.com/sharepoint/soap/CheckOutFile"  -H "Content-Type: text/xml; charset=utf-8" https://mysharepointserver.com/sites/mysite/myfile.txt -k

soapdata.xml包含WSDL所描述的检出所需的SOAP数据。上面的命令有什么问题,或者有一个更简单的方法来做这个CURL像检查case?

soapdata.xml contains the SOAP data needed for checkout as described by WSDL. Is there something wrong in above command or is there a simpler way to do this with CURL like the checkin case?

推荐答案

示例,使用SOAP方法,CURL命令中的URL应该是共享点站点Lists.asmx的路径,而不是要检出的文件的URL。文件URL只需要在soapdata xml的pageUrl字段中,如下所示:

Found from an example that, with SOAP approach, the URL in CURL command should be the path of the sharepoint site Lists.asmx and not the URL of file to be checked out. The file URL need to be only in the pageUrl field in soapdata xml as follows:

curl --ntlm --user username:password -d @soapdata.xml -H "SOAPAction: http://schemas.microsoft.com/sharepoint/soap/CheckOutFile" -H "Content-Type: text/xml; charset=utf-8" -k -v https://mysharepointserver.com/sites/mysite/_vti_bin/Lists.asmx

其中soapdata的内容。 xml:

where contents of soapdata.xml:

<?xml version="1.0" encoding="utf-8"?>
<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>
    <CheckOutFile xmlns="http://schemas.microsoft.com/sharepoint/soap/">
      <pageUrl>https://mysharepointserver.com/sites/mysite/myfile.txt</pageUrl>
      <checkoutToLocal>true</checkoutToLocal>
      <lastmodified/>
    </CheckOutFile>
  </soap:Body>
</soap:Envelope>

这篇关于如何从共享点文档库使用curl签出文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆