$Buffer = New-Object System.Byte($BlockSize) $BinaryReader = New-Object System.IO.BinaryReader($Filestream) $Filestream = ::Open($FilePath, ::Open, ::Read, ::ReadWrite) $FileCreationInfo.ContentStream = $FileStream $FileStream = New-Object IO.FileStream($FilePath,::Open) $BlockSize = $FileChunkSize * 1024 * 1024 #Function to Upload Large File to SharePoint Online Libraryįunction Upload-LargeFile($FilePath, $LibraryName, $FileChunkSize=10) However, when you upload a larger file from a slow network, it timeouts if the upload operation takes more than 30 minutes. Write-host "Error Uploading File: $($_.Exception.Message)" -foregroundcolor Red Write-host "File uploaded Successfully!" -f Green ::SaveBinaryDirect($Ctx, $TargetFileURL, $FileStream,$True) $TargetFileURL = $TargetFolderURL "/" $SourceFileName $SourceFileName = Split-path $FilePath -leaf $FileStream = ( (Get-Item $FilePath)).OpenRead() $Ctx.Credentials = New-Object ($Cred.UserName,$Cred.Password) $FilePath = "C:\Users\Thomas\Downloads\WF圆4.zip" $TargetFolderURL = "/sites/marketing/Shared Documents" Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\"Īdd-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\.dll"
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |