Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/sharepoint/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/180.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何使用curl从sharepoint文档库检出文件?_Sharepoint_Soap_Curl - Fatal编程技术网

如何使用curl从sharepoint文档库检出文件?

如何使用curl从sharepoint文档库检出文件?,sharepoint,soap,curl,Sharepoint,Soap,Curl,可以使用curl,使用以下命令将文件签入sharepoint文档库,如中所述: 但是如何首先从文档库中签出文件(使用curl) 我尝试了一种方法,通过如下方式传递SOAPAction checkoutfile头文件和数据,但即使服务器返回响应:“200OK”,也没有效果 curl --ntlm --user username:password -d @soapdata.xml -H "SOAPAction: http://schemas.microsoft.com/sharepoint/soap

可以使用curl,使用以下命令将文件签入sharepoint文档库,如中所述:

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

我尝试了一种方法,通过如下方式传递SOAPAction checkoutfile头文件和数据,但即使服务器返回响应:“200OK”,也没有效果

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
xml包含WSDL所描述的签出所需的SOAP数据。上述命令是否有错误,或者是否有一种更简单的方法可以像签入案例那样使用CURL执行此操作?

从一个示例中发现,使用SOAP方法,CURL命令中的URL应该是sharepoint site List.asmx的路径,而不是要签出的文件的URL。文件URL只需位于soapdata xml中的pageUrl字段中,如下所示:

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的内容:

<?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>

https://mysharepointserver.com/sites/mysite/myfile.txt
真的
从中找到,使用SOAP方法,CURL命令中的URL应该是sharepoint site List.asmx的路径,而不是要签出的文件的URL。文件URL只需位于soapdata xml中的pageUrl字段中,如下所示:

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的内容:

<?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>

https://mysharepointserver.com/sites/mysite/myfile.txt
真的