You see a warning in a SharePoint document library that says the library is approaching the 5000 item limit. The warning appears even when the library contains far fewer than 5000 items. This happens because SharePoint counts items in the current view, not the total number of files in the library. This article explains why the threshold warning triggers early and how to fix it by adjusting views and settings.
Key Takeaways: Fixing the 5000 Item Threshold Warning
- Library Settings > Advanced Settings > Indexed Columns: Adding an index to a column used in the view prevents the warning from appearing below 5000 items.
- Create a view with indexed columns: A view that sorts or filters by an indexed column avoids the threshold warning entirely.
- Change the default view: Set a view using indexed columns as the default to stop the warning for all users.
Why the Library Threshold Warning Appears Below 5000 Items
SharePoint has a list view threshold of 5000 items per view. This limit applies to the number of items that a view must process, not the total number of items in the library. When a view queries a large set of items, SharePoint must scan all items that match the query. If that query returns more than 5000 items, the threshold warning appears.
The warning can appear even when the library has fewer than 5000 total items. This occurs when the current view does not use an indexed column. Without an index, SharePoint must scan every item in the library to build the view. If the library has 1000 items, but the view has no indexed column, the warning may still appear because the query is not optimized.
The root cause is that the default view in many libraries does not include an indexed column. The most common columns used in views are Title, Modified, and Created. These columns are not indexed by default. When a view sorts or filters by a non-indexed column, SharePoint scans all items to satisfy the query. This triggers the warning even at low item counts.
Steps to Fix the Library Threshold Warning
You need to add an index to a column used in the view and then update the view to use that column. Follow these steps in order.
Check the Current View and Identify Columns
- Open the document library
Go to the SharePoint site that contains the library. Click the library name in the left navigation or Quick Launch. - Open the current view
Click the drop-down arrow next to the view name at the top of the library. The default view is usually called All Documents. Note the columns used for sorting and filtering. - Check the sort order
In the view drop-down, select Modify current view. Look at the Sort section to see which column is used for sorting. If no column is specified, the view sorts by ID or Title by default. - Note the filter columns
In the Filter section, see if any column is used to filter items. If the view has no filter, the view returns all items in the library.
Add an Index to a Column
- Go to Library Settings
Click the gear icon in the top right corner of the library page. Select Library settings from the menu. - Open Indexed Columns
Under the Columns section, click Indexed columns. This shows a list of existing indexes. If no indexes exist, the list is empty. - Create a new index
Click Create a new index. In the Primary column drop-down, select a column that appears in the current view. Good choices are Created, Modified, or any metadata column used for sorting or filtering. Click Create. - Wait for the index to build
SharePoint builds the index in the background. This may take a few minutes for large libraries. Do not proceed until the index is built.
Update the View to Use the Indexed Column
- Return to Library Settings
Click Library settings from the gear menu again if you navigated away. - Open the view you want to fix
Under the Views section, click the name of the view that shows the warning. For example, click All Documents. - Change the sort order
In the Sort section, select the column you indexed as the first sort column. For example, select Modified. Set the order to Show items in ascending order or descending order. - Add a filter if needed
In the Filter section, add a filter using the indexed column. For example, set Modified is greater than [Today]-30 to show only items modified in the last 30 days. This reduces the query size. - Save the view
Scroll to the bottom and click OK. The view now uses the indexed column, and the threshold warning should disappear.
Set the Fixed View as Default
- Go to Library Settings
Click the gear icon and select Library settings. - Open the view settings
Under the Views section, click the name of the view you just fixed. - Make it the default view
Scroll to the top of the view settings page. In the View options section, set Make this the default view to Yes. Click OK.
If the Warning Still Appears After the Main Fix
Library Uses a Non-Indexed Column in a Group By
When a view groups items by a column that is not indexed, SharePoint still scans all items. Open the view settings and check the Group By section. If grouping is enabled, change the group by column to the indexed column or remove grouping entirely. After saving, the warning should stop.
Library Has Too Many Folders
Folders count toward the view threshold. If the library has a deep folder structure, the total number of folders plus files may exceed 5000 in the view. Use a flat folder structure or create views that filter by a date column to exclude old folders. Move old files to an archive library to reduce the count.
View Includes All Items Without a Filter
A view with no filter returns every item in the library. If the library has more than 5000 items, the warning appears regardless of indexing. Add a filter to the view that limits results. For example, use a date filter to show only items from the current year. This keeps the query under 5000 items.
Power Automate or Custom Code Triggers the Warning
Automations that query the library with non-indexed columns can also trigger the warning. Check any Power Automate flows or custom scripts that access the library. Update the queries to use indexed columns or add filters. If the flow queries all items, change it to query only the needed subset.
View with Index vs View without Index: Effect on Threshold
| Item | View with Indexed Column | View without Indexed Column |
|---|---|---|
| Query performance | Fast, uses index to locate items | Slow, scans all items in library |
| Threshold warning at 1000 items | No warning appears | Warning may appear if no filter is used |
| Threshold warning at 5000 items | No warning if query returns under 5000 | Warning appears when query returns 5000+ items |
| Sorting behavior | Sorts by indexed column efficiently | Sorts by any column but scans all items |
| Filter support | Filter on indexed column is efficient | Filter on non-indexed column still scans all items |
You can now fix the library threshold warning by adding an index to a column and updating the view. Next, review all views in the library and apply the same fix to each one. For advanced management, use the SharePoint admin center to set list view threshold limits at the tenant level.