繁体   English   中英

如何使用Powershell和(S)SOM将文件/目录上载到Office365中的sharepoint 2013?

[英]How to use powershell and the (S)SOM to upload files/directories into sharepoint 2013 in Office365?

我想启动一个新脚本,该脚本采用本地文件路径和文档库名称,然后抓取目录,并将找到的所有文件/文件夹上载到sharepoint 2014 Office 365文档库(服务器端对象模型)中{SOM})。

我尝试了以下方法,但没有成功:

  1. http://www.toddklindt.com/blog/Lists/Posts/Post.aspx?ID=487
  2. https://gallery.technet.microsoft.com/office/Copy-all-SharePoint-Files-0999c53f
  3. https://camerondwyer.wordpress.com/2013/05/27/how-to-import-upload-an-entire-folder-of-files-to-sharepoint-using-powershell/

我们的租户是可能的– office 365我们正在使用sharepoint 2013我们希望能够查看一个文件夹,并使用具有文件夹结构的所有文档,并通过powershell将结构和文件复制到我们的sharepoint租户。

您尝试使用的链接正在使用SharePoint服务器对象模型,该模型仅适用于SharePoint内部部署。 您需要SharePoint客户端对象模型才能与SharePoint Online一起使用。

Brendan Griffin在此处发布了有关使用客户端对象模型和PowerShell将文件上传到SharePoint Online文档库的文章: http : //blogs.technet.com/b/fromthefield/archive/2014/02/19/office365-script-对上载文件到一个使用文档库,-csom.aspx

这是PowerShell代码的关键部分,在ClientContext上设置了SharePoint Online凭据:

#Bind to site collection
$Context = New-Object Microsoft.SharePoint.Client.ClientContext($SiteURL)
$Creds = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($User,$Password)
$Context.Credentials = $Creds

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM