如何使用Perl将文件上传到Office365

如何使用Perl将文件上传到Office365

本文介绍了如何使用Perl将文件上传到Office365 SharePoint?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人可以建议将文件上传到Office365 SharePoint吗?

Can someone please advise on uploading files to Office365 SharePoint?

我认为应该使用DAV协议完成此操作,因此 HTTP :: DAV 应该是正确的库,但是如何对其进行编码以使其与 Office365 一起使用? Office365托管的每个帐户都有一个TeamSite网站,希望可以通过DAV进行访问.请告知.

I believe this should be done using the DAV protocol, so HTTP::DAV should be right library for that, but how to code it to make it work with Office365? Each account hosted with Office365 has a TeamSite website, which hopefully can be accessible with DAV. Please advise.

推荐答案

使用WebClient类将大型文档上传到SharePoint网站提供了一个使用DAV上载文档的示例.

Upload large documents to SharePoint site using WebClient class gives an example of using DAV to upload a document.

WebClient oWebClient = new WebClient();

oWebClient.UseDefaultCredentials = true;
byte[] bFile = System.IO.File.ReadAllBytes(@"C:\Sundar\WEB315.wmv");

string ulr = @"http://lt010593/Shared Documents/WEB315.wmv";
System.Uri oUri = new System.Uri(ulr);

oWebClient.UploadDataAsync(oUri, "PUT", bFile);
oWebClient.UploadDataCompleted += new UploadDataCompletedEventHandler(oWebClient_UploadDataCompleted);

牢记该示例,任务是查看 WebClient文档找出 oWebClient.UseDefaultCredentials = true; 确实如此.

With that example in mind, the task is to look at WebClient documentation to figure out what oWebClient.UseDefaultCredentials = true; really does.

所以,看来,任务是弄清楚要发送的凭据信息.其余的似乎是一个简单的PUT请求.

So, it seems, the task is to figure out what credential information is sent. The rest seems to be a simple PUT request.

这篇关于如何使用Perl将文件上传到Office365 SharePoint?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-04 11:55