[英]How can I upload a file to a Sharepoint Document Library using Silverlight and client web-services?
我在Sharepoint文檔庫上載中遇到的大多數解決方案都使用HTTP“ PUT”方法,但是我在Silverlight中很難找到一種解決方法,因為它對HTTP方法有限制。 我訪問了此http://msdn.microsoft.com/zh-cn/library/dd920295(VS.95).aspx,以了解如何在我的代碼中允許使用PUT,但是我找不到如何幫助您使用HTTP的方法“放”。
我正在使用客戶端Web服務,因此限制了一些可用的Sharepoint功能。
這給我留下了以下問題:
謝謝
弄清楚了!! 奇跡般有效
public void UploadFile(String fileName, byte[] file)
{
// format the destination URL
string[] destinationUrls = {"http://qa.sp.dca/sites/silverlight/Answers/"+fileName};
// fill out the metadata
// remark: don't set the Name field, because this is the name of the document
SharepointCopy.FieldInformation titleInformation = new SharepointCopy.FieldInformation
{DisplayName =fileName,
InternalName =fileName,
Type = SharepointCopy.FieldType.Text,
Value =fileName};
// to specify the content type
SharepointCopy.FieldInformation ctInformation = new SharepointCopy.FieldInformation
{DisplayName ="XML Answer Doc",
InternalName ="ContentType",
Type = SharepointCopy.
FieldType.Text,
Value ="xml"};
SharepointCopy.FieldInformation[] metadata = { titleInformation };
// initialize the web service
SharepointCopy.CopySoapClient copyws = new SharepointCopy.CopySoapClient();
// execute the CopyIntoItems method
copyws.CopyIntoItemsCompleted += copyws_CopyIntoItemsCompleted;
copyws.CopyIntoItemsAsync("http://null", destinationUrls, metadata, file);
}
非常感謝Karine Bosch在這里提供的解決方案: http : //social.msdn.microsoft.com/Forums/en/sharepointdevelopment/thread/f135aaa2-3345-483f-ade4-e4fd597d50d4
什么類型的SharePoint部署和什么版本的Silverlight? 如果說這是Intranet部署,則可以使用UNC路徑訪問sharepoint中的文檔庫以及Silverlight 3中可用的savefiledialog / openfiledialog。
http://progproblems.blogspot.com/2009/11/saveread-file-from-silverlight-30-in.html
要么
http://www.kirupa.com/blend_silverlight/saving_file_locally_pg1.htm
Silverlight在處理本地文件方面有一些限制,盡管我已經了解到Silverlight 4有所更改。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.