Quantcast
Channel: SharePoint 2013 - Development and Programming forum
Viewing all articles
Browse latest Browse all 7589

Download Large Files from SharePoint Online

$
0
0

I have a C# application in which, using the SharePoint.Client dll, I make client requests to SharePoint Online. Recently, as per  this post, I was able to successfully upload a single 5GB file to SharePoint Online Document Library. However, I am unable to download the same! Here's what I have tried so far:

1. OpenBinaryDirect

FileInformation fileInformation = File.OpenBinaryDirect(clientContext, serverRelativeUrl);

The above line of code executes successfully for smaller files. But when I try to download my 5GB file, it throws anIOException: Stream was too long.

2. OpenBinaryStream

File oFile = web.GetFileByServerRelativeUrl(strServerRelativeURL);
clientContext.Load(oFile);
ClientResult<Stream> stream = oFile.OpenBinaryStream();
clientContext.ExecuteQuery();

There again, for the same set of smaller files, the above code also executes successfully and the files get downloaded easily. But the download of the 5GB file fails immediately at the ExecuteQuery line with aFormatException: Invalid MIME content-length header encountered on read.

Is there a way to download large files from SharePoint Online through code? I can directly download the file from the browser, but not sure how to do the same through code. Plz advice.


EDIT: 1 Here's a reference to a blog which confirms the fact that SharePoint now allows uploading files upto 10 GB each.


Viewing all articles
Browse latest Browse all 7589

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>