OneDrive large file download

Babu P 1 Reputation point
2022-05-26T13:51:19.837+00:00

I want download large file from onedrive(18GB) using graph Api.

I used below code

stream = await graphClient.Users["xxxxxyyyy"].Drive.Items["tttthhhyyy"].Content

                                                                   .Request()

                                                                   .GetAsync();

it's throwing below error

Cannot write more bytes to the buffer than the configured maximum buffer size: 2147483647.

Could you please help me with this issue.

Thanks in advance

Babu.

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
13,575 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Srinivasa Rao Darna 6,761 Reputation points Microsoft External Staff
    2022-05-27T06:34:48.65+00:00

    Hi @Babu P ,

    Consider using Partial range downloads, Note that you must append the Range header to the actual @microsoft.graph.downloadUrl URL and not to the request for content.

    Example snippet using C# SDK download-a-large-file-from-onedrive

    Hope this helps.

    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have further questions about this answer, please click "Comment".


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.