I have a list that contains tens of thousands of items.
I have tried to limit the query using a where
clause, like this:
var list = Context.Web.Lists.GetByTitle(title);
string query = $@"<Query>
<Where>
<Lt>
<FieldRef Name='ID' /><Value Type='Integer'>100</Value>
</Lt>
</Where>
<OrderBy><FieldRef Name='ID' Ascending='true' /></OrderBy>
</Query>";
var camlQuery = new CamlQuery();
camlQuery.ViewXml = query;
var items = list.GetItems(camlQuery);
Context.Load(items);
Context.ExecuteQuery();
But I'm getting SPQueryThrottledException
anyway:
The attempted operation is prohibited because it exceeds the list view threshold enforced by the administrator.
How do I query large sp list?