What is the actual size limit for uploading files to SharePoint Document Library using MS Graph?

PsDev 0 Reputation points
2024-02-24T15:43:40.8033333+00:00

I am working on uploading certain files to SharePoint Document Library using Microsoft Graph SDK for PowerShell. From the documentation, I understand that there are two ways to do that - either through a single API call or by creating an upload session for larger files. This is where the confusion lies.

If I use the a single API call endpoint (given below), what's the maximum limit for the file size that can be uploaded?

PUT /drives/{drive-id}/items/{parent-id}:/{filename}:/content

Because two documents, given below, mention two different limits. One mentions 250mb (more recently edited) and the other mentions 4mb. They both mention different limits for the same endpoints with the same purpose - upload a new file or update an existing file in OneDrive or SharePoint Document Library. What is the correct size limit that one should consider?

  1. (250mb) https://learn.microsoft.com/en-us/graph/api/driveitem-put-content?view=graph-rest-1.0&tabs=http
  2. (4mb) https://learn.microsoft.com/en-us/onedrive/developer/rest-api/api/driveitem_put_content?view=odsp-graph-online Any help on this would be highly appreciated. Also, I use this command to upload files via PowerShell Set-MgDriveItemContent (https://learn.microsoft.com/en-us/powershell/module/microsoft.graph.files/set-mgdriveitemcontent?view=graph-powershell-1.0)

Thanks

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
11,774 questions
SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
10,611 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. RaytheonXie_MSFT 34,741 Reputation points Microsoft Vendor
    2024-02-26T07:33:35.01+00:00

    Hi @PsDev, Per my test, the 250mb should be the size limit for sharepoint online and 4mb is the limit for onedrive. For powershell, you could refer to following script to upload large file https://pnp.github.io/script-samples/graph-upload-file-to-sharepoint/README.html?tabs=azure-cli

    ---If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment". Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


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.