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 throttling limit on 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 ""

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

Case 2: Invalid Field Names
When fetching fields, use internal field names or check whether the particular field exists before trying to get 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, 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 required field property to true on your content types!

1 comment:

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


Please Login and comment to get your questions answered!

Powered by Blogger.