SharePoint site page Graph API endpoint fails with status code 422

Matthew Watts 25 Reputation points
2023-05-02T13:44:57.8+00:00

Hi,

We've integrated with the beta version of the Graph API, using the below call:

https://graph.microsoft.com/beta/sites/{{siteId}}/pages

Where the "{{siteId}}" variable is the ID of a site in our SharePoint tenant.

Whenever we query this endpoint for one of our sites, we receive the below:

HTTP Status 422:

{
    "error": {
        "code": "notSupported",
        "message": "The request is unprocessable because it uses too many resources",
        "innerError": {
            "code": "tooManyResources",
            "date": "2023-05-02T13:37:57",
            "request-id": "eedfa0a2-a72f-4b50-a571-70a2ac503929",
            "client-request-id": "eedfa0a2-a72f-4b50-a571-70a2ac503929"
        }
    }
}

Is there any way we can circumvent this error? I've tried using pagination in my calls but this doesn't work.

It's worth noting that this works fine for 4/5 sites we've tried internally, but one of these fails. I have a suspicion it's due to the number of pages in the SharePoint site, but these currently cannot be archived down or deleted.

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
11,025 questions
SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
9,993 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. RaytheonXie_MSFT 32,476 Reputation points Microsoft Vendor
    2023-05-03T02:12:30.34+00:00

    Hi @Matthew Watts

    You could fix the issue by add Prefer: apiversion=2.1 to request header. Here is a similar issue with yours, please make a reference

    https://stackoverflow.com/questions/68410872/microsoft-graph-returns-422-error-on-querying-sharepoint-subsites

    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.