SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Hi Guys I have this problem:

I query a list using Caml.

items = list.GetItems(query);

This returns 6 items and works ok. Then I do:

foreach (SPListItem item in items)
     var title = item["Title"];//this row throws the exception

And I get the following exception.

Argument Exception - Value does not fall within the expected range.

What I tried:

The item is not null.

I iterated through the item fields, got their internal names and all the fields are there.

The field name is correct.

I increased the List View Lookup Threshold from 8 up to 1000(does not seem help).

If that matters - the code is used in the execute method of a timer job(I restart the timer service every time so the code is up to date).

Any ideas?

Edit 1

Here is the Caml Query:

SPQuery query = new SPQuery();
string workingCaml = "<Where><BeginsWith><FieldRef Name=\"ContentTypeId\"/><Value Type=\"ContentTypeId\">0x01005AC98BAE1E70FB4A91957E3135BF85B3</Value></BeginsWith></Where>";
query.Query = workingCaml;
share|improve this question
Can you include your query? Have you tried by including Title in the ViewFields property of the query? – Naim Mar 19 '14 at 7:28
Yes I tried that, it didn't work – Gesh Mar 19 '14 at 7:33
Hi, try this. Instead of the Title, fetch the ID:- item["ID"] Let me know if this works.. Then, I can suggest a possible solution.! Also I want to know if you are using SPQuery object? – variable Mar 19 '14 at 7:35
up vote 7 down vote accepted

If fetching of item["ID"] instead of 'Title' works AND If you are using the SPQuery object. Then, include the columns that you want to fetch in the ViewFields property of SPQuery. This will resolve your issue.


share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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