Hi,
We are performing operation on library having 5000+ documents.I find that any CSOM operation on the List having 5000+ throws the threshold error .How to over come this issue ?
Error: "The attempted operation is prohibited because it exceeds the list view threshold enforced by the administrator"
I have this code mentioned below
Whenever I try to load below statements for a list having 5001 docs it is throwing threshold error.
Is this a limitation using CSOM ?
cContext.Load(list2.RootFolder.Folders);
Sample code:
string fileUrl = "https://.sharepoint.com/sites/";
Uri fileUri = new Uri(fileUrl);
var x = fileUri.Scheme + Uri.SchemeDelimiter + fileUri.Host;
ClientContext rootContext = new ClientContext(fileUri.Scheme + Uri.SchemeDelimiter + fileUri.Host);
rootContext.Credentials = BuildCreds();
Uri webUrl = Web.WebUrlFromPageUrlDirect(rootContext, fileUri);
ClientContext cContext = new ClientContext(webUrl.ToString());
cContext.Credentials = BuildCreds();
cContext.Load(cContext.Web);
cContext.ExecuteQuery();
ListCollection siteLists = cContext.Web.Lists;
cContext.Load(siteLists);
cContext.ExecuteQuery();
foreach (List list2 in siteLists)
{
try
{
cContext.Load(list2);
cContext.Load(list2.RootFolder);
cContext.Load(list2.RootFolder.Folders);
cContext.ExecuteQuery();
}
catch
{
}
}