Forum Discussion

Tamras1972's avatar
Tamras1972
Iron Contributor
Aug 01, 2023

SharePoint Classic - Rest API - Javascript

We have this page with CEWP that pulls data from a list and displays on a datatable.  Currently, there are over 16k records in the list but I thought as long as the filter returns less than 5000, it should work? It was working since 2020 but it just recently started giving this error. 

In the js file, it keeps returning the following error:

 

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

 



Here's the payload (all selected and filtered fields are indexed):

 

$select: Id, Absentee, StartDateISO, EndDateISO, EventDate, EndDate, Section, ActivityType, Status, RequestType
$filter: (((StartDateISO ge datetime'2023-08-02T07:00:00.000Z') and (StartDateISO le datetime'2023-08-31T07:00:00.000Z') and (Section eq 'X Section'))or ((EndDateISO ge datetime'2023-08-02T07:00:00.000Z') and (EndDateISO le datetime'2023-08-31T07:00:00.000Z') and (Section eq 'XSection'))or ((StartDateISO ge datetime'2023-08-02T07:00:00.000Z') and (EndDateISO le datetime'2023-08-31T07:00:00.000Z') and (Section eq 'X Section')))

 


But when I filter the same in Power Automate, it only returned around 300 items. 

 

  • Fixed the issue by changing the filter:  

    $filter: ((EndDateISO ge datetime'2023-08-02T07:00:00.000Z') and (StartDateISO le datetime'2023-08-31T07:00:00.000Z') and (Section eq 'X Section'))
  • Tamras1972's avatar
    Tamras1972
    Iron Contributor

    Fixed the issue by changing the filter:  

    $filter: ((EndDateISO ge datetime'2023-08-02T07:00:00.000Z') and (StartDateISO le datetime'2023-08-31T07:00:00.000Z') and (Section eq 'X Section'))

Resources