1

I have a list with about 15 managed metadata columns in it. Now I want to query that list using CSOM. I don't want to retrieve all the columns values so I limited the column values retrieved by using the include function. See code below

CamlQuery query = CamlQuery.CreateAllItemsQuery();
ListItemCollection items = pagesList.GetItems(query);
ctx.Load(items, item => item.Include(i => i["Column1"]));
ctx.ExecuteQuery();

When I execute the code I get the following error "Value does not fall within the expected range." For the first managed metadata columns in the list, this is working fine. So looks like the list view lookup threshold is the problem.

I also tried to retrieve the same column when querying only one item and this was working fine.

ListItem litem =pagesList.GetItemById(1);
ctx.Load(litem, i => i["Column1"]);
ctx.ExecuteQuery();

This is expected behavior if I look to the list view lookup threshold, because the following line is in the explanation of this threshold: "This does not apply to single item operations". See msdn post below. http://technet.microsoft.com/en-us/library/cc262787(v=office.15).aspx#ListLibrary

My question is, why do I have problems with the list view lookup threshold? I'm only trying to retrieve 1 managed metadatafield. Is there a way to solve this issue?

1

I think you want to use the overload that takes in a ViewFields param array: MSDN Article

Try the following:

CamlQuery query = CamlQuery.CreateAllItemsQuery(1000, "Column1");
ListItemCollection items = pagesList.GetItems(query);
ctx.Load(items);
ctx.ExecuteQuery();
0

Maybe your list contains an item, which does not have the Field "Column1"? It does not look like a treshold problem (as per default the treshold is 5000 items and i guess you didn´t set it to 1)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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