I have an issue with Sharepoint CSOM when I am trying to get subfolder with the following code

public void LoadFolders(Folder folder, SharePointFolder sharePointFolder)

  foreach (var subFolder in folder.Folders)
    var subRootFolder = new SharePointFolder(sharePointFolder, subFolder);

I get the error below when trying to load subfolders of a folder that has an itemCount of more than 5000.

  Message=The attempted operation is prohibited because it exceeds the list view threshold enforced by the administrator.
   at Microsoft.SharePoint.Client.ClientRequest.ProcessResponseStream(Stream responseStream)
   at Microsoft.SharePoint.Client.ClientRequest.ProcessResponse()
   at Microsoft.SharePoint.Client.ClientRequest.ExecuteQueryToServer(ChunkStringBuilder sb)
   at Microsoft.SharePoint.Client.ClientContext.ExecuteQuery()
   at ..SharePointApi.SharepointSdkAccessMethod.LoadFolders(Folder folder, SharePointFolder sharePointFolder) in ..\..\SharePointApi\SharepointSdkAccessMethod.cs:line 435
   at ..SharePoint.ViewModels.SharePointFoldersViewModel.<>c__DisplayClass30_0.<GetFolderAsync>b__0() in ..\..\ViewModels\SharePointFoldersViewModel.cs:line 183
   at System.Threading.Tasks.Task.InnerInvoke()
   at System.Threading.Tasks.Task.Execute()

Is there a way to resolve this issue or a CamlQuery that can give the same result as my function above?

  • What version of sharepoint do you have?
    – Billy P
    Commented Nov 22, 2020 at 21:32
  • Hello Hawk, we are using SharePoint 365 online Commented Nov 23, 2020 at 7:30

1 Answer 1


Check the threshold from Central Administration -> Manage Web Applications

Select the Web App -> from Ribbon Click on General Settings -> Resource Throttling

Then increase the threshold if it is still on the default value 5000

enter image description here enter image description here


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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