Getting error on Core.ListViewThreshold code while using camlQuery.FolderServerRelativeUrl property

Copper Contributor


Issue/Error Details

I am trying to retrieve files from a specific document library folder(with RecursiveAll view option) using "GetListItemsByBatch()" method in the below mentioned code file. The document library am using is having more than 40000 files/folders and folder specific folder which am querying is at 4th to 5th level hierarchy and contains very few files.

So while using the below PNP code to retrieve files from specific folder I set the camlQuery.FolderServerRelativeUrl = "/sites/site1/Doclibrary/Folder1/Folder2/Folder3/Folder4/Folder5";

When i executed the code i got Error "The attempted operation is prohibited because it exceeds the list view threshold enforced by the administrator".

when i executed the same code without the "FolderServerRelativeUrl" property, I am able to retrieve all the 40000 files from document library.

Please note that, View scope should be set to Recursive All.


Steps to Reproduce

Execute the "GetListItemsByBatch()" method on a document library which is having more than 5000 or 20000 files/folders and set the property camlQuery.FolderServerRelativeUrl to point to specific folder at 4th or 5th level. Please note that, View scope should be set to Recursive All. PFB

       //Set View Scope for the Query


Pnp Code Location:



[ ] Office 365 / SharePoint Online


0 Replies