List view threshold error(5000 items issue) in SharePoint On-Premise/SharePoint Online

List view threshold error(5000 items issue) in SharePoint On-Premise/SharePoint Online – proven

No comments


List view threshold error – Many times when we deal with the big lists in SharePoint, we get the error: “This view cannot be displayed because it exceeds the list view threshold (5000 items) enforced by the administrator”. In this article, we will learn about the root cause of this error and its fix.

Introduction – List view threshold error

The threshold concept was introduced in SharePoint 2010 considering the performance issue while loading the big list to improve the query performance. There is a wrong perception about the SharePoint list view threshold 5000 error – many users think that the SharePoint list/library just can store 5000 items but that is not true, in fact, the SharePoint list can store 30 million items. Then why are we getting this error? Before we analyze this error I recommend you to read my previous articles  “How does the database column indexing work in SharePoint?” and  “How to create indexed column in SharePoint?

Why do we get a 5000 threshold error (List view threshold error)?

This error actually comes from SQL, not from SharePoint. As I have explained in my previous article “How does the database column indexing work in SharePoint?” there we have seen that SharePoint stores all of its list data and list columns in a single SQL table, i.e. “AllUserData” table.

Now we need to learn how the query gets processed (List view threshold error)

When we browse a list or library SharePoint sends a query to SQL and SQL process that query and send the result to SharePoint, then finally we can see the result i.e. nothing but list or library items in the browser. Let’s take an example of the “All Items” view(assumed that no filters were applied to it) – when we click on this view SharePoint will build a query and pass this on to SQL, then SQL process that query and send the result to SharePoint. Now if the results returned by the query are more than 5000 then the user gets the above-mentioned list view threshold error.

List view threshold error - limitation in SQL sorry something went wrong

Why does this limitation set as 5000 in SQL (List view threshold error)?

Due to performance reasons, if the SQL server performs the query on a single table (here it is: “AllUserData” table) which would result in the output of more than 5000 items, in this case, the SQL server will lock the entire table while the query execution is on – this is the default behavior of SQL by the designed.

So when the “AllUserData” table is locked – what will it happen?

So far as we have learned that SharePoint stores all list/library data in a single table i.e “AllUserData” – a single query that returns more than 5,000 items will lock all of the list and library data for that entire content database.

In this scenario – the business users who were accessing the content in SharePoint from the same content site collection (content database) while the “AllUserData” table is locked, will have to wait a long time for their results to be displayed.

By now we have learned about the root cause of threshold error and we need to focus on how to move on with this situation as the business has to run.

How to overcome the 5000 items list view threshold issue?

We can increase the list items limit from 5000 to 50000(fifty thousand) in SharePoint on-premise, in fact, we can disable the list view threshold limit which is not all recommended but in SharePoint online we don’t have control over it, so we need to move on with the whatever limitation is set i.e. 5000.

Here based on my experience, I will list some tips and tricks to avoid this issue which will work both for SharePoint Online and on-premise.

  • Planning – before creating the list or library, analyze the data, and plan accordingly. Try to split the data into multiple lists or libraries.
  • Create multiple views and add the “AND” condition in the list filter criteria, never add the “OR” condition, the “OR” condition will try to get the all data.
  • Create an index column – we can only have 20 indexed columns in a given list. so we need to plan this thoughtfully!
  • We can not create an indexed column if the list is already hitting the list view threshold limit.
  • Maintain the Archive list – here we need to review the list items periodically and need to check whether some items can be deleted or archived to another list – where we can write some automation jobs which will be moving the items periodically to another archive list automatically.
  • In the list filter criteria, we need to filter the list items in such a way that at any given point of time list view will return less than 5000 items using the filter on created column technique(please see the explanation below).

Create filter [Today]- “number of days” (List view threshold error)

Here one of the techniques is – to create a filter on the “Created” column and use the [Today]- “number of days” with less than or equal to the condition, something like below:

How to overcome the 5000 items list view threshold issue


The logic behind the filter on the created column is – this will try to get the items that will return less than 5000 items. If this condition also returns more than 5000 items, we need to split this up created column conditions with multiple “AND” conditions with the combination of some other column to ensure the filter returns less than 5000 items as the below example – through the implementation of this technique is time-consuming.

list exceeds 5000 items in SharePoint Online list

Practically – let’s see when what happens when a list exceeds 5000 items (List view threshold error).

I have created a list named “Test List” which adds more than 5000 items using the below PowerShell script to see what happens when it crosses the 5000 limits.


#Load SharePoint CSOM Assemblies
#Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.dll"
#Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.Runtime.dll"

$fileName = "Adding_Multiple_Items_Report"
$enddate = (Get-Date).tostring("yyyyMMddhhmmss")
$logFileName = $fileName +"_"+ $enddate+"_Log.txt"   
$invocation = (Get-Variable MyInvocation).Value  
$directoryPath = Split-Path $invocation.MyCommand.Path 

if(!(Test-Path -path $directoryPathForLog))  
            New-Item -ItemType directory -Path $directoryPathForLog
$logPath = $directoryPathForLog + "\" + $logFileName  
$isLogFileCreated = $False 

#DLL location
$directoryPathForDLL=$directoryPath+"\"+"Dependency Files"
if(!(Test-Path -path $directoryPathForDLL))  
            New-Item -ItemType directory -Path $directoryPathForDLL

#DLL location

Add-Type -Path $clientDLL
Add-Type -Path $clientDLLRuntime

function Write-Log([string]$logMsg)  
        Write-Host "Creating Log File..."   
        if(!(Test-Path -path $directoryPath))  
            Write-Host "Please Provide Proper Log Path" -ForegroundColor Red   
            $script:isLogFileCreated = $True   
            Write-Host "Log File ($logFileName) Created..."   
            [string]$logMessage = [System.String]::Format("[$(Get-Date)] - {0}", $logMsg)   
            Add-Content -Path $logPath -Value $logMessage   
        [string]$logMessage = [System.String]::Format("[$(Get-Date)] - {0}", $logMsg)   
        Add-Content -Path $logPath -Value $logMessage   

#variables region.
$password = "Pass@Word1357"
$spListName="Test List"
#variables region end.

$securePassword= $Password | ConvertTo-SecureString -AsPlainText -Force
#Setup the Context

$ctx = New-Object Microsoft.SharePoint.Client.ClientContext($siteURL)
$ctx.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($spUserName, $securePassword)

#Get the list
$spList = $ctx.Web.Lists.GetByTitle($spListName)

# Loop to create list items
for($i=1; $i -le 5001; $i++)
  $listItemCreationInformationInSPOnline = New-Object Microsoft.SharePoint.Client.ListItemCreationInformation
  $newListItemInSPOnline = $spList.AddItem($listItemCreationInformationInSPOnline)
  $newListItemInSPOnline["Title"] = "CustomItemNumberAddedThruCode_$($i)"
  $newListItemInSPOnline["CustomItemNumber"] = $i;

  write-host "Item created: CustomItemNumberAddedThruCode_$($i)"

    $errorMessage = $_.Exception.Message +"in adding mulitple items in SP Online list using CSOM PowerShell script";
    Write-Host $errorMessage -BackgroundColor Red
    Write-Log $errorMessage 
Write-Host "##########################################################"  -ForegroundColor Green 
Write-Host "The script execution has been completed!" -ForegroundColor Green 
Write-Host "##########################################################"


Execute the above script like below:

List View 5000 Add Items in SharePoint list using PowerShell

Now if we go to the list setting page (example as “Test List”), we can see the message below which says this list exceeds the 5000 threshold limit.

List view threshold error(5000 items issue) in SharePoint

Summary: List view threshold error (how to overcome the 5000 items list view threshold issue)

Thus, in this article we have learned the below concept with respect to the SharePoint list view threshold:

  • What is the threshold issue in the SharePoint list?
  • Why do we get a 5000 threshold error?
  • Why does this limitation set as 5,000 in SQL?
  • How to overcome the 5000 items list view threshold issue?
  • Practically – saw what happens when a list exceeds 5000 items.
  • How to fix the list view threshold enforced by the administrator error in SharePoint Online and On-Premise.
  • How to fix that “this view cannot be displayed because it exceeds the list view threshold (5000 items) enforced by the administrator”


Having described the threshold limit issue and their possible workaround to fix this in SharePoint – it’s an impending open issue over a decade from Microsoft, which really Microsoft needs to fix or come up with some inbuilt alternate technique. This issue is one of the drawbacks of SharePoint which leads to many business user dissatisfactions with SharePoint. So Microsoft really needs to fix this issue in the long run!!!

See Also: SharePoint Online Tutorial

You may also like the below SharePoint Online tutorials:


PDF Download Image

Download SharePoint Online & Office 365 Administration eBook

Buy the premium version of SharePoint Online & Office 365 administration eBook from here:

Buy SharePoint Online & Office 365 Administration eBook


Get the free demo PDF eBook from here:


Send download link to:

Subscribe to get exclusive content and recommendations every month. You can unsubscribe anytime.

About Post Author

Do you have a better solution or question on this topic? Please leave a comment