Forum Discussion
LucasMdVelop
May 17, 2023Copper Contributor
Get an "Microsoft.SharePoint.SPQueryThrottledException" Exception, but try only to get one ListItem.
Hello,
i started half year ago to work as an developer for an SharePoint adapter. Now i get a support ticket with an error, which i don't understand.
In my developer Environment i do not have this error.
The complete Error message in german (english below) is:
Microsoft.SharePoint.SPQueryThrottledException "Der versuchte Vorgang ist unzulässig, weil er den Schwellenwert für die Listenansicht überschreitet."
"The number of items in this list exceeds the list view threshold"
I read in the documentation, that this is happening when i try to get more then 5.000 items in one request. But i try to get only 1 item.
I used this function:
/_api/web/lists(guid'478b0098-4608-4381-b78b-bdc9c0490f8f')/RenderListDataAsStream
With the 2 parameters "FilterField1"= list id and "FilterValue2" = item id.
Maybe i need a special configuration in SharePoint?
Thanks for any help and have a nice day
Lucas
LucasMdVelop Are you using SharePoint online or SharePoint server? Can you provide complete code you are using?
If you want to filter list items based on item ID, you can use REST API endpoint like:
<siteUrl>/_api/web/lists/getbytitle('My List Name')/items(10)
Where 10 is the list item ID.
If you are trying to filter list items based on custom column in list, you can try adding indexing on that list column: Add an index to a list or library column
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.