Get Throttling headers from Graph API C# reqeusts.

Amit Singh Rawat 731 Reputation points
2023-08-17T06:19:08.5533333+00:00

Hi,

I am using Microsoft Graph API (C#) to traverse SharePoint Environment. As per below document, Microsoft also send usefull information to avoid throttling like Retry-After, RateLimit etc.

https://learn.microsoft.com/en-us/sharepoint/dev/general-development/how-to-avoid-getting-throttled-or-blocked-in-sharepoint-online

When I execute below or similar query. I am not getting these details in response to Graph API request.

var searchQuery = configuration.GetValue<string>("SiteToScan");
                var responseSites = await graphClient.Sites.GetAllSites.GetAsync((requestConfiguration) =>
                {
                    requestConfiguration.QueryParameters.Filter = $"webUrl eq '{searchQuery}'";
                });
Microsoft 365 and Office | SharePoint | Development
Microsoft 365 and Office | SharePoint | For business | Windows
Microsoft Security | Microsoft Graph
Developer technologies | C#
Developer technologies | C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
{count} votes

1 answer

Sort by: Most helpful
  1. Anonymous
    2023-08-17T07:29:35.0633333+00:00

    Hi@ASR

    You are using the Microsoft Graph API, not the SharePoint REST API.

    The SharePoint REST API will return more restrictive information, such as response headers such as Retry-After, X-SharePointHealthScore, and X-MSDAVEXT_Error.

    Microsoft Graph API only returns HTTP status code 429 (Too many requests) and Retry-After response header to indicate the limitation

    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.

    Best Regards

    Cheng Feng


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.