Friday, February 9, 2018

Get All List Items from SharePoint List page wise to handle threshold limit


Below is the common error during development:
The attempted operation is prohibited because it exceeds the list view threshold enforced by the administrator. 
How to handle in client object model?
  • To avoid threshold error, we can use below orderby query.
OrderBy Override='TRUE'>

  • Using Sorting on the returned list
items = items.OrderBy(item => item.FieldValues["FileLeafRef"]).ToList();
  • Implementing the search on the items. Sample below which brings matched document string name on the page
items = items.FindAll(f => f.FieldValues["FileLeafRef"].ToString().ToLower().Contains("".ToLower())).ToList();

  •  Complete Method

No comments:

Post a Comment