如何使用Perl将文件上传到Office365 SharePoint? [英] How can I upload files to Office365 SharePoint with Perl?

查看:174
本文介绍了如何使用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.

推荐答案

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.

如果服务器请求,则应使用当前登录用户的默认凭据对由WebClient对象发出的请求进行身份验证时,将此属性设置为true.对于客户端应用程序,这是大多数情况下所需的行为.对于中间层应用程序,例如ASP.NET应用程序,通常不使用此属性,而是将Credentials属性设置为代表其请求的客户端的凭据.

Set this property to true when requests made by this WebClient object should, if requested by the server, be authenticated using the default credentials of the currently logged on user. For client applications, this is the desired behavior in most scenarios. For middle tier applications, such as ASP.NET applications, instead of using this property, you would typically set the Credentials property to the credentials of the client on whose behalf the request is made.

所以,看来,任务是弄清楚要发送的凭据信息.其余的似乎是一个简单的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?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆