我遇到的Sharepoint doc库上传的大多数解决方案都使用HTTP“PUT”方法,但我在Silverlight中找不到这样做的方法,因为它对HTTP方法有限制。我访问了这个http://msdn.microsoft.com/en-us/library/dd920295(VS.95).aspx以了解如何在我的代码中允许PUT,但我找不到它如何帮助您使用HTTP“PUT”。
我正在使用客户端Web服务,因此限制了一些可用的Sharepoint功能。
这让我想到了这些问题:
由于
答案 0 :(得分:1)
想出来!!像魅力一样工作
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
答案 1 :(得分:0)
什么类型的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有一些变化。