CAML query ListItemCollectionPosition
I have this application, in CSOM, which used to get the entire ListItems of a SharePoint List at one go to perform certain operations. All was well and good, until, I exported a brand new SharePoint List from Excel. The List had around 5400 items (>5000). When I tried to fetch all of its items, in the same way, I received the following error:
SharePoint has this threshold set in place where we can not query more than 5000 items in a single request. While this limit can be altered in its on-prem edition, in SharePoint Online, theres no way that we can modify this value! The official reason given for this is:
The workaround for this, through code, is to query ListItems in batches. In our CAML query, we have this provision to define the
Following is the code snippet: using (ClientContext ctx = new ClientContext("siteUrl")) { ctx.Credentials = new SharePointOnlineCredentials("", GetSecureStringPassword()); List list = ctx.Web.Lists.GetByTitle("ListName"); CamlQuery camlQuery = new CamlQuery(); camlQuery.ViewXml = "Key Takeaways
Share:Related
|