Forum Discussion

Tanmay_Parulekar's avatar
Tanmay_Parulekar
Copper Contributor
Aug 18, 2023

REST API -"The attempted operation is prohibited because it exceeds the list view threshold." issue

Hello,

I have a library that contains 10,000 records. There is a single-choice column called "testColumn," which is indexed. When I hit the API on the library, I encounter the error message: "The attempted operation is prohibited because it exceeds the list view threshold."

I verified the actual results by fetching all the data using a recursive JavaScript function and applying a filter after fetching. This should provide me with 2400 results.

I am confused about why this issue is persisting.

2 Replies

  • Tanmay_Parulekar Can you show us the API request endpoint you are using?

     

    Make sure you have added proper filter condition in the API call which will return less than 5000 items in single API call. Also, add $top=5000 in your API call like: 

    <siteUrl>/_api/web/lists/getbytitle('List Name')/items?$filter=MyChoiceColumn eq 'CHOICE1'&$top=5000

    Where MyChoiceColumn is the internal name of your choice column. You can get the internal name of your column by following this article: How to find the Internal name of columns in SharePoint Online? 


    Please click Mark as Best Response & Like if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.

    • Tanmay_Parulekar's avatar
      Tanmay_Parulekar
      Copper Contributor

      ganeshsanap 

      You are right about the TOP in answer, but that's not an issue over here

      Here is the API endpoint


      https://<Sharepoint Site>/_api/web/lists/getByTitle('Library')/items?$select=File/Name&$expand=File&$filter=MyChoiceColumn eq 'CHOICE1'&$top=5000

Resources