Forum Discussion
How to uploads files to OneDrive for Business using Powershell
And also I am getting below error if I am uploading files larger than 200 MB.
Exception calling "ExecuteQuery" with "0" argument(s): "The operation has timed out"
At C:\Users\uday-\Desktop\New Text Document (2).ps1:55 char:1
+ $Context.ExecuteQuery()
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : WebException
Yes, this script only support upto 250 mb size for single file so if you want to upload more than 250mb file size of single file, you can refer the below link.
https://gist.github.com/asadrefai/ecfb32db81acaa80282d
- Uday Kiran ReddyDec 16, 2017Copper Contributor
UploadFileInSlice ($ctx, $libraryName, $fileName, $fileChunkSizeInMB)
What is the $ctx we need to pass?
- Manidurai MohanamariappanDec 16, 2017Iron Contributor
Yes you need to pass the $ctx, $ctx is Client context
$ctx = New-Object Microsoft.SharePoint.Client.ClientContext($SiteURL)
$Creds = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($User,$Password)
$ctx.Credentials = $Creds