无法使用curl NTLM将文档和元数据上传到共享点

时间:2018-07-05 05:30:54

标签: curl sharepoint ntlm

我使用curl将文档和文档的元数据上传到SharePoint,但失败了。我在Windows中运行了命令 以下是我尝试过的命令

成功(不包括元数据)

C:\curl-7.59.0\src\curl -k -v --ntlm --user user1@devuat:user1pass --upload-file mark1.txt https://aura/sites/2018/DIGITAL%20AUTO/07Jul/01/mark1.txt

失败(在-F中包含一些元数据)

C:\curl-7.59.0\src\curl -k -v --ntlm --user user1@devuat:user1pass -F 'Account_No=123123' --upload-file mark1.txt https://aura/sites/2018/DIGITAL%20AUTO/07Jul/01/mark1.txt

成功,但是在共享点中看不到任何元数据(在request.xml中包含一些元数据)

C:\curl-7.59.0\src\curl -k -v --ntlm --user user1@devuat:user1pass --data request.xml --upload-file mark1.txt https://aura/sites/2018/DIGITAL%20AUTO/07Jul/01/mark1.txt

request.xml如下:

<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
  <soap12:Body>
    <CopyIntoItems xmlns="http://schemas.microsoft.com/sharepoint/soap/">
      <SourceUrl>string</SourceUrl>
      <DestinationUrls>
        <string>string</string>
        <string>string</string>
      </DestinationUrls>
      <Fields>
        <FieldInformation Type="Invalid or Integer or Text or Note or DateTime or Counter or Choice or Lookup or Boolean or Number or Currency or URL or Computed or Threading or Guid or MultiChoice or GridChoice or Calculated or File or Attachments or User or Recurrence or CrossProjectLink or ModStat or AllDayEvent or Error" DisplayName="string" InternalName="string" Id="guid" Value="string" />
        <FieldInformation Type="Invalid or Integer or Text or Note or DateTime or Counter or Choice or Lookup or Boolean or Number or Currency or URL or Computed or Threading or Guid or MultiChoice or GridChoice or Calculated or File or Attachments or User or Recurrence or CrossProjectLink or ModStat or AllDayEvent or Error" DisplayName="string" InternalName="string" Id="guid" Value="string" />
      </Fields>
      <Stream>base64Binary</Stream>
    </CopyIntoItems>
  </soap12:Body>
</soap12:Envelope>

我使用下面的代码获得了base64Binary:  var base64 = require('file-base64');

base64.encode('mark1.txt', function(err, base64String) {
  console.log(base64String);
});

0 个答案:

没有答案