0

I was trying to upload the a larger file (500mb) to SharePoint Online document library. I followed the way to upload the file in Chunks with the Article: Programmatically Uploading Large Files In SharePoint Online

Startupload and continueupload works well But, finishupload(uploadid,offset) fails at last chunks with an saying:

"Microsoft.SharePoint.Utilities.SPBITSSessionIncompleteException" "The upload was incomplete, Try to save again"**.

I have already tried changing the chunk size 10mb to 100mb but It fails every time at finishupload.

The same behavior works fine when I use a CSOM way, following this code: https://piyushksingh.com/2016/07/22/upload-large-files-to-sharepoint-online/

1 Answer 1

0

I would recommend use PNP core sdk to upload large file in SharePoint online library.

Use below code to upload large file in SharePoint online library.

// Get a reference to a folder
IFolder siteAssetsFolder = await context.Web.Folders.Where(f => f.Name == "SiteAssets").FirstOrDefaultAsync();

// Upload a file by adding it to the folder's files collection, the file will be uploaded in chunks of 10MB
IFile addedFile = await siteAssetsFolder.Files.AddAsync("2gbfile.test", 
                  System.IO.File.OpenRead($".{Path.DirectorySeparatorChar}TestFilesFolder{Path.DirectorySeparatorChar}2gbfile.test"));

Refer this PNP core SDK docs.

Upload Large file

2
  • I am looking for a JavaScript solutions, which can be used inside my client side application.
    – meeus
    Feb 23, 2022 at 13:29
  • 1
    There is a pnp js way to upload the files in chunks, I recently got this solution. pnp.github.io/pnpjs/sp/files/#adding-files
    – meeus
    Mar 22, 2022 at 12:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.