2011-12-02 27 views
0

我試圖使用SOAP動作CopyIntoItems的Sharepoint SOAP操作參數

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文件或文檔文件。我使用的Firefox擴展海報

我源和目標網址

應該是什麼的<FieldInformation><Stream>值是多少?

預先感謝

維夫

回答

0

流值需要的文件的使用Base64Binary表示。因此,例如,我有一個文本文件,其中包含文本「123」。使用這個網站http://www.base64converter.com/我將文本轉換爲base64,並轉換爲「MTIz」。所以如果我試圖上傳我的文件,我會把「MTIz」(不帶引號)放到Stream標籤中。事情是這樣的:

<Stream>MTIz</Stream> 

的FieldInformation標籤必須包含需要與您上載的文件關聯的任何SharePoint屬性。所以如果你想將標題屬性設置爲「我的文檔」,你需要這樣的東西:

<FieldInformation Type="Text" DisplayName="Title" InternalName="Title" Id="{fa564e0f-0c70-4ab9-b863-0177e6ddd247}" Value="My Document" /> 
+0

你是如何生成Id的? – Vivek

+0

該ID是您嘗試更新字段的guid表示形式。要找到它,您可以: - 使用SharePoint Manager之類的工具查看 - 轉到列表中的內容類型,複製字段url,複製FID後的屬性,並用{和%7D替換%7B替換爲} – TroyBramley