Fix “Value does not fall within the expected range” Error in SharePoint

Problem: SharePoint site gave “System.ArgumentException: Value does not fall within the expected range” error!

Here are some possible root causes and solutions:

Case 1: While fetching List item Lookup values programmatically

Root cause: List view threshold value exceeded! This occurs due to the throttling limit on the list view lookup threshold value under web application settings. Try increasing it.

  • Go to Central Administration >> Application Management >> Manage web applications
  • Select your web application, click on General Settings >> Resource Throttling from the ribbon
  • Enter the value for List View Lookup Threshold. E.g. 36
    Fix "Value does not fall within the expected range" Error in SharePoint

PowerShell script to increase list view lookup threshold value.

Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue

$WebApp = Get-SPWebApplication "https://sharepoint.crescent.com/"

#Set List View Lookup Threshold  
$WebApp.MaxQueryLookupFields = 36
$WebApp.Update()

Case 2: Invalid Field Names

When fetching fields, use internal field names or check whether the particular field exists before getting its value. E.g., use item.Fields.ContainsField(“Title”) before fetching or updating a specific field. So, if you got this error after activating a feature or deploying a solution, the culprit is your recent feature/solution!

Case 3: During Check-In under SharePoint Document Library

Got this error while checking in a document? Well, the solution is simple – Do not set the required field property to true on your content types!

Salaudeen Rajack

Salaudeen Rajack - Information Technology Expert with Two-decades of hands-on experience, specializing in SharePoint, PowerShell, Microsoft 365, and related products. He has held various positions including SharePoint Architect, Administrator, Developer and consultant, has helped many organizations to implement and optimize SharePoint solutions. Known for his deep technical expertise, He's passionate about sharing the knowledge and insights to help others, through the real-world articles!

One thought on “Fix “Value does not fall within the expected range” Error in SharePoint

  • Hi I’m Getting this error while clicking version history of Documents. Any idea about this?

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *