SharePoint REST api SPQueryThrottledException

Monika V 70 Reputation points
2023-08-08T09:59:42.0066667+00:00

Hello All,

we are facing an issue with REST API call on a List exceeded the threshold limit.

I have a List in a SharePoint Online site collection that has exceeded 5000 items and I have created indexed columns that are needed in the REST API filter but still getting Threshold error.

 

Below is the Rest API query I use to fetch the data from the list.

_api/web/lists/getbytitle('Libraryname')/items?$filter=Department eq 'Test'&$top=10&$skip=0&$orderby=Modified

The above query gave me an error as threshold limit exceeded.

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

Microsoft 365 and Office SharePoint For business Windows
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Anonymous
    2023-08-09T05:39:39.5033333+00:00

    Hi @Monika V

    Thanks for letting us know your user experience. According to your case description, I do understand how frustrated you are now.

     

    When I received the case, I searched a lot of documents did a lot of researches. And I feel regretful to inform you that it turns out to be a by-design one.

    This is a known issue with the SharePoint REST API.

    It will throw an error if the query (or the first part of the filter query) returns more than 5000 items, even if you only use and return one item. $filter $top

    This doesn't work even if you are indexing the column. If possible, try reducing the number of items returned in the first part of the query.

    Here is a link on how to get by recursively calling:

    https://sharepoint.stackexchange.com/questions/217254/rest-to-read-more-than-5000-items-from-document-library


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    Best Regards

    Cheng Feng

    1 person found this answer helpful.

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.