Wednesday, 23 April 2014

SharePoint 2010 list view throttling and custom CAML

SharePoint 2010 list view throttling and custom CAML queries
Error:  ActiveX error 500
SharePoint List Throttling & Indexed Columns
Recently i faced one problem while getting list data using client object model.
i used caml query, it was working fine, when the list item count is <5000. One day list item count is exceeds 5000 then my query is not working.
I have tried below approach to solve the problem.
Create Index in Any column in the List
Update the Quey with Indexed column.
Ex:
"<Query>"
+"<Where><And><IsNotNull><FieldRef Name=\"IndexedColumn\" /></IsNotNull>"
+<Eq><FieldRef Name=\"Column2\" /><Value Type=\"Text\">"Search Key Word"</Value></Eq>
+"</And></Where>"
+"<OrderBy>"
+"<FieldRef Name='SID' Ascending='False' />"
+"</OrderBy>"
+"</Query>";
-------------------------------------------------------------------------------------------------------
Another Solution
Try to query against the lookup value, so that it will solve the problem.
If you are over the list view threhold limit you have to query against the id and then it works:
string query = @" <Where><Eq><FieldRef Name='Land' LookupId='TRUE' /> <Value Type='Integer'>1</Value> ";