I have a list item with one field Classes which is a multiple choice lookup. I want to implement an ASPX page which contains a ListBox which is filled with values from the Classes field. The following method does that:

private void GetSelectedClasses()
    SPFieldLookupValueCollection currentSelection;

    using (SPWeb web = this.Web)

        currentSelection = item["Classes"] as SPFieldLookupValueCollection;
        foreach (SPFieldLookupValue value in currentSelection)

This method works fine if I run/debug/deploy it with my account which is a SharePoint admin. However, when I run it under User1 account, which has contribute permissions on the site and the list which contains the list item, I get the strange error:

System.ArgumentException: Value does not fall within the expected range.

The error is happening in the line
currentSelection = item["Classes"] as SPFieldLookupValueCollection;
When I promote the User1 to Full Control permissions user or even site collection administrator, I am still getting the error. The ArgumentException appears to be firing because the field named Classes doesn't exist, allegedly. This is of course not true, because checking the item fields does list it and it all works well with my default account.

Could anyone help me out? I feel quite desperate. Thanks!

  • I've also noticed that the same exception is thrown for all fields that are not of type text. This is really really weird.
    – Boris
    Commented Jun 11, 2012 at 23:27

1 Answer 1


Ok, I've solved it. I am not sure why, but when I use User1 account, I need to explicitly specify the fields I want to get when I am retrieving SPItem object. So, previously I have had instantiated the item object with the following line:

this.item = this.list.Items.GetItemById(Convert.ToInt32(itemId, CultureInfo.InvariantCulture));

But, in order to have my Classes field included in the query, I need to use:

this.item = this.list.GetItemByIdSelectedFields(Convert.ToInt32(itemId, CultureInfo.InvariantCulture), "Classes");

My GetSelectedClasses() method mentioned in the question body is actually correct.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.