Let's say there is a list with very large number of records. Now applying a particular filter on a list also retrieves very large number of items, more than threshold value. Retrieving list item is creating performance issue. Now, server side code is not permitted, only client side code is permitted. How to tackle this issue? What steps should be taken?

1 Answer 1


You can use CAML queries. These queries are executed in the server and will retrieve only the items requested for.

Use Pagination to iterate through the items. For that you can use ListItemCollectionPosition

Here is a snippet you are use for this

ClientContext clientContext = new ClientContext("weburl");
List list = clientContext.Web.Lists.GetByTitle("ListTitle");
ListItemCollectionPosition position = null;
    CamlQuery camlQuery = new CamlQuery();
    camlQuery.ListItemCollectionPosition = position;
    camlQuery.ViewXml = @"<View>
                              <FieldRef Name='Title'/>
    ListItemCollection listItems = list.GetItems(camlQuery);
    position = listItems.ListItemCollectionPosition;
    foreach (ListItem listItem in listItems)
        Console.WriteLine("Title: {0}", listItem["Title"]);
while(position != null)
  • Yes this solution is working.. but if we add <Query></Query> and use non index column.. It's not working.. have any solution for this?
    – SID
    Mar 2, 2017 at 11:26
  • Depends on your requirements ! What you have to do ? Feb 2, 2018 at 11:09
  • @SID non index column will not work in the caml query, in case if you need to include those columns, you will have to index those columns
    – Pradeep
    Apr 17, 2019 at 5:09
  • @SID maximum of 20 columns can be indexed
    – Pradeep
    Apr 17, 2019 at 5:10

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