[英]How to check-out a file from sharepoint document library using curl?
可以使用curl在問題中提到的以下命令將文件檢入到sharepoint文檔庫中:
curl --ntlm --user username:password --upload-file file.txt https://mysharepointserver.com/sites/mysite/myfile.txt -k
但是如何首先從文檔庫中檢出文件(使用curl)?
我嘗試通過如下方式傳遞SOAPAction checkoutfile標頭和數據來嘗試一種方法,但是即使服務器返回了響應,該方法也無效:“ 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做到這一點,例如簽入情況?
從一個示例中發現,使用SOAP方法,CURL命令中的URL應該是共享點站點Lists.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>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.