SharePoint 2010 Value does not fall within the expected range
12,578
The problem was in the List View Lookup Threshold parameter:
- Login to Central Administration.
- In section Application Management click Manage Web Applications.
- Pick desired web application.
- In the ribbon above click General Settings and pick Resource Throttling from dropdown menu.
- Find the List View Lookup Threshold and change it's value (from 8 to 10 in my case).
Comments
-
Enam over 1 year
On the development server everything was OK but after deployment there is an
ArgumentException: Value does not fall within the expected range.
Unfortunately, there is no way to directly debug failing web part so i've got only some log information (e.g. exception message above and code section shown below). Here is a code throwing the exception:using (SPSite site = new SPSite("http://mysite")) { using (SPWeb web = site.OpenWeb()) { SPList list = web.Lists.TryGetList("MySPList"); foreach (SPListItem item in list.Items) { if (item["Code"].ToString() == code) { if (item["Favorites"] != null) { if (item["Favorites"].ToString().Contains(web.CurrentUser.ID + ";#" + web.CurrentUser.Name)) { // first case simple code } else { // second case simple code } } else { // second case simple code } break; } } } }