Forum Discussion

VCLantern's avatar
VCLantern
Copper Contributor
May 25, 2024

Using SharePoint REST API to fetch folders & files list

I'm using SharePoint REST API to read Folders & Files in my web app. The connection and function works well. For some specific folders when reading the list of sub-folder within I'm getting error like this:

 

{ "odata.error": { "code": "-2147024860, Microsoft.SharePoint.SPQueryThrottledException", "message": { "lang": "en-US", "value": "The attempted operation is prohibited because it exceeds the list view threshold." } } } 

 

 

 

This happens when the folder content is more than 5000. My folder has 5015 sub-folders within it.

 

To be able to read the folders I made the function to fetch sub-folders in batches. My Endpoint to fetch has extra parameters - $filter & $top.

 

{{base_url}}/sites/{{site_name}}/_api/web/GetFolderByServerRelativeUrl('Shared Documents/Limit Check Folder 5000')/?$expand=folders&$orderby=Created&$filter=(Created gt datetime'2024-05-24T00:00:00.000Z')&$top=100

 

For some reason, the filtering is not getting applied. I've made sure that the Library has the Column Created indexed as well.

 

What is wrong with this, is the GetFolderByServerRelativeUrl not allowed to fetch data in batches?

 

 

No RepliesBe the first to reply

Resources