Click here to Skip to main content
15,888,351 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
SharePoint is configured with a default threshold limit of 5000 items in a list or library. This means that if the items in a list or library exceed that number, any views, grouping and queries will fail, So there is any work-around/solution to handle this issue of SharePoint by API? and Why SharePoint set such a rule?

What I have tried:

C#
spContext.Credentials =
                  new SharePointOnlineCredentials(
                      ConfigurationManager.AppSettings[ConfigurationConstants.SharePointUserName],
                      SharePointHelper.GetSecureString());

              // Add our User Agent information
              spContext.ExecutingWebRequest += delegate (object sender, WebRequestEventArgs e)
              {
                  e.WebRequestExecutor.WebRequest.UserAgent = "NONISV|Contoso|GovernanceCheck/1.0";
              };
Posted
Updated 23-Oct-18 8:39am

1 solution

The solution you have implemented is to avoid request throttling. Your solution will (theoretically) allow you to make more requests in the same amount of time.

I think what you are looking is a way to overcome the 5000 item limit when querying a list or library. The following link has a complete sample and also contains a SharePoint Online compatible version of the ContentIterator, which is specially made to handle large amounts of list items:
PnP/Samples/Core.ListViewThreshold at master · SharePoint/PnP · GitHub[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900