How to fix "The request is unprocessable because it uses too many resources" in graph API?

Siva M 35 Reputation points
2024-03-20T10:44:11.6633333+00:00

I have a task where I need to retrieve items from a SharePoint list, and the list contains over 20,000 records. However, when attempting to filter by a specific range of dates using the createdDateTime property, I encounter an error stating "The request is unprocessable because it uses too many resources."

How can this issue be resolved?

Alternatively, I'd like to know the maximum limit for the response that the Graph API can return.

Please note that all columns in the SharePoint list have been correctly indexed.

Sample API Endpoint is given below:

https://graph.microsoft.com/v1.0/sites/{siteid}/lists/{list id}/items?$expand=fields($select=Title,DeliveryNumber,Trucktype,DNNoteFileURL,DeliveryStatus,id,Created,DriverMobileNumber,Trucknumber,CompanyName,DriverName,TripNumber,TransporterName,AssignedDriverEmail,CreatedDateTime,ReassignedMobNo,DN_No_Check)&$filter=fields/Created ge '2024-02-01' and fields/Created le '2024-03-19' and fields/DeliveryStatus eq 'Pending'&$orderby=fields/Created desc&$top=499

Error Details:

User's image

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
11,254 questions
SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
10,150 questions
SharePoint Development
SharePoint Development
SharePoint: A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.Development: The process of researching, productizing, and refining new or existing technologies.
2,783 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Emily Du-MSFT 43,511 Reputation points Microsoft Vendor
    2024-03-21T10:13:35.46+00:00

    In general, adding all columns used in the Graph query into indexed columns solves the issue.

    You could try to add a header: prefer: HonorNonIndexedQueriesWarningMayFailRandomly to make the filter run successfully.

    User's image


    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.