Tuesday 8 January 2013

Value does not fall within the expected range

I get this error when I try to retrieve a field. The name of the field is ok and I check the internal name with CAML Query Builder and it is ok as well.

foreach (TaxonomyFieldValue JURISDICTION in (TaxonomyFieldValueCollection)item["Jurisdiction"])                          
{
    switch (JURISDICTION.Label.ToLower())
    {
        case "uk": this.CHKJUK.Checked = true; break;
        case "england": this.CHKJEngland.Checked = true; break;
        case "scotland": this.CHKJScotland.Checked = true; break;
        case "wales": this.CHKJWales.Checked = true; break;
        case "northern ireland": this.CHKJNIreland.Checked = true; break;
        case "Republic of Ireland": this.CHKJRIreland.Checked = true; break;
        case "eu": this.CHKJEU.Checked = true; break;
        default: break;
    }                                
}

To fix it, increase the List View Threshold:

1- Login to Central Admin
2- Go to Application Management -> Manage Web Applications
3- Pick the Web application for which you want to change the LVT (If you only have 1 web app plus the central admin one, the one you want to pick is the 1 web app; changing this for the central admin does you no good)
4- In the ribbon above, click General Settings. That will bring down a menu, from which you should pick Resource Throttling
5- Change the LVT (first item in this list) to another value and press OK, but please try to keep it to a reasonable number!

No comments: