Question about document library/folder limitations for a large number of files

New Contributor



So I know SharePoint Online lists hit some limitations and reduction in features when the list gets over 5,000 entries. The searching and filtering gets limited. Does this also happen for document libraries? I'm wondering how this specific setup would be affected:


  1. Document Library
    1. Folder 1
      1. sub folder 1a
        1. 2,000 files
      2. sub folder 1b
        1. 1,100 files
      3. sub folder 1c
        1. 2,000 files
    2. Folder 2
      1. sub folder 2a 
        1. 1,000+ files
      2. sub folder 2b
        1. 1,000 files
      3. sub folder 2c
        1. 2,000 files


Would the entire document library reach that 5,000 limitation when the any combination of folders/subfolders total 5,000 files? Or does it happen only at the Folder level? Or only at the sub folder level?



2 Replies
Hi, you are referring to the ListViewThreshold which, as you say, is limited to 5,000 items per list or library view.

In the scenario above, creating multiple subfolders is effectively partitioning the library, meaning that at any given level in the folder structure, as long as you don't have more than 5,000 items (files or folders) at that level, then you will be fine. Where you would have trouble is if you created a view that flattened the folder structure, returning for instance all documents ordered by most recent created date across all folders...that would throw a ListViewThreshold error.

FYI, if you're browsing the library via the modern library experience then the threshold is increased to, as far I'm aware, 20,000 items. If you are using the classic experience, or some alternative method to query such as programmatically, then it would again revert back to 5,000.

It's worth noting separately that although the above may work from a threshold perspective, if you are expecting to store that volume of files in a single library, you need to consider what happens if someone chooses to sync the whole library. OneDrive has its own limitations, in that if you try and sync a library (or even or a subfolder within a library) that has more than 100,000 items you will start to experience some serious performance impacts. If there is an option for you to create multiple document libraries at the first layer of the structure, instead of a single library with folders, this will reduce the likelihood of users simply syncing everything
Thank you for the response!

Good to know that it treats it as each folder being its own level. I'm not sure what you mean by the view that would flatten the folder structure. Could you elaborate on that?

As for syncing, I am going to discuss that with the person in charge of the request and see how they want to handle it. Currently just doing an initial setup to get ideas.