我正在尝试使用SOAP Action上传文件
POST /_vti_bin/Copy.asmx HTTP/1.1
Host: my.hostname.net
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://schemas.microsoft.com/sharepoint/soap/CopyIntoItems"
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap: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>
</soap:Body>
</soap:Envelope>
我希望上传PDF文件或Doc文件。我正在使用Firefox扩展海报
我有源和目标网址
<FieldInformation>
和<Stream>
的价值应该是什么?
提前致谢
维夫
答案 0 :(得分:0)
流值必须是文件的base64binary表示。例如,我有一个包含文本“123”的文本文件。使用此站点http://www.base64converter.com/我将文本转换为base64,转换为“MTIz”。因此,如果我尝试上传我的文件,我会将“MTIz”(不含引号)放入Stream标记中。像这样:
<Stream>MTIz</Stream>
FieldInformation标记需要包含需要与要上载的文档关联的所有SharePoint属性。因此,如果要将title属性设置为“My Document”,则需要以下内容:
<FieldInformation Type="Text" DisplayName="Title" InternalName="Title" Id="{fa564e0f-0c70-4ab9-b863-0177e6ddd247}" Value="My Document" />