Reputation: 3546
I would like to start up a new script, which takes in a Local file path, and a document library name, and then scrapes the directory, and uploads all files/folders found into the sharepoint 2014 office 365 document library (server side object model {SOM}).
I have tried the following, to no success:
Our tenant is in the could - office 365 We are using sharepoint 2013 We want to be able to look into a folder, and take all documents with folder structure and, via powershell, copy structure and files to our sharepoint tenant.
Upvotes: 1
Views: 2676
Reputation: 241
The links you have tried are using the SharePoint server object model which only works for SharePoint on-premises. You need the SharePoint client side object model to work with SharePoint Online.
Brendan Griffin posted an article on uploading files to a SharePoint Online document library using the client side object model and PowerShell here: http://blogs.technet.com/b/fromthefield/archive/2014/02/19/office365-script-to-upload-files-to-a-document-library-using-csom.aspx
Here's a key part of the PowerShell code where the SharePoint Online credentials are set on the ClientContext:
#Bind to site collection
$Context = New-Object Microsoft.SharePoint.Client.ClientContext($SiteURL)
$Creds = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($User,$Password)
$Context.Credentials = $Creds
Upvotes: 2