SharePoint Online: Rest API not working with people filter for list with more than 5000 items

Copper Contributor

Hi Folks,

 

I'm trying to use SharePoint rest API to get items from a SPO list. It has around 15K items. But I'm using filters and expecting less than 30 items in the result. It works fine when normal columns are used for filtering. But when I use people picker column, it throws the below error:

 

 

<m:error xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
<m:code>-2147024860, Microsoft.SharePoint.SPQueryThrottledException</m:code>
<m:message xml:lang="en-US">The attempted operation is prohibited because it exceeds the list view threshold.</m:message>
</m:error>

 

 

Below is the query I used:

 

 

https://test.sharepoint.com/sites/SiteName/_api/web/lists/getbytitle('ListName')/items?$select=ID,Employee/EMail,Employee/Title,Employee/JobTitle,Employee/Department&$expand=Employee/Id&$filter=(Employee/email address removed for privacy reasons%27)

 

 

Could anyone help me fix this issue?

3 Replies

@rbn_neu 

 

You should Index our people picker column and then it should work.

 

kalpeshvaghela_0-1658754084600.png

Hope it will helpful to you.

@kalpeshvaghela 

 

Thank you for the suggestion. The people picker column is already indexed. Could you please let me know if this actually worked for you for lists with more than 5K items. I have received this suggestion before to index the column, just want to know if this worked for anyone.

 

Thank you. 

I have just added a new discussion reporting a similar issue with the Title column when there is more than 5000 items in the library. The first filter returns around 100 items, but adding a filter by the Title shows nothing. I suspect it's related - despite the initial filter returning only 100 items, the second filter is working against ALL the items.