I am tring to upload large files (900 MB) to SP Online (actually the OneDrive Business) but seems to follow SP style.
Tried this via CSOM and powershell 70 MB are fine but when I try 900 MB a timeout happens after 3min
Error :
Exception calling "ExecuteQuery" with "0" argument(s): "The operation has timed out" At C:\scripts\BackupToCloud\BackupToCloud1.ps1:89 char:1 + $ctx.ExecuteQuery() + ~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [], MethodInvocationException + FullyQualifiedErrorId : WebException
My upload part (of the script):
Foreach ($File in (dir $LocalBckupFolder))
{
$StartAFile = get-date -uformat "%Y-%m-%d %H:%M:%S"
Add-Content $log "$StartAFile :: Start Upload file: $File.name"
$FileStream = New-Object IO.FileStream($File.FullName,[System.IO.FileMode]::Open)
$FileCreationInfo = New-Object Microsoft.SharePoint.Client.FileCreationInformation
$FileCreationInfo.Overwrite = $true
$FileCreationInfo.ContentStream = $FileStream
$FileCreationInfo.URL = $File
$Upload = $SPfolder.Files.Add($FileCreationInfo)
$ctx.Load($Upload)
$ctx.ExecuteQuery()
$FinishAFile = get-date -uformat "%Y-%m-%d %H:%M:%S"
Add-Content $log "$FinishAFile :: Done Upload file: $File.name"
}
$ctx.Dispose()
Try to use $ctx.RequestTimeout = = 3600000;
or $ctx.RequestTimeout = int.MaxValue;
but this is not recognized.
As SharePoint Online doesn't offer the Get-SPWebApplication
I can't set timeout there as I could on premise (no Get-SPOWebApplication
available).
Also if large file upload via powershell to O365 (SP or OneDrive) should be done differently I'm open for suggestions.