SharePoint / SharePoint/sp-dev-docs

Quota is not reset after waiting RateLimit-Reset time

Open
#10,070 26 comments 0 reactions 1 assignee View on GitHub

@Ashlesha-MSFT is already working on this.

Since Mar 24, 2025.

area:docs Needs: Author Feedback sharepoint-developer-support type:bug-suspected
Dominant language
PowerShell
Stars
1.4k
Forks
1.1k
Avg merge
4d 12h
Merged PRs (30d)
12

Description

Target SharePoint environment

SharePoint Online

What SharePoint development model, framework, SDK or API is this about?

SharePoint CSOM

Developer environment

Windows

What browser(s) / client(s) have you tested
  • 💥 Internet Explorer
  • 💥 Microsoft Edge
  • 💥 Google Chrome
  • 💥 FireFox
  • 💥 Safari
  • mobile (iOS/iPadOS)
  • mobile (Android)
  • not applicable
  • other (enter in the "Additional environment details" area below)
Additional environment details
  • Microsoft.SharePointOnline.CSOM 16.1.22810.12000
  • .NET 6
Describe the bug / error

While developing and testing the RateLimit headers which SharePoint online provides we noticed that the RateLimit-Reset value does not imply the number of seconds an app should wait before the quota is fully reset.

RateLimit-Reset

In the documentation https://learn.microsoft.com/en-us/sharepoint/dev/general-development/how-to-avoid-getting-throttled-or-blocked-in-sharepoint-online is stated that RateLimit-Reset value is the number of seconds before the quota is reset.

In our testing we see that after we wait the number of seconds specified by the RateLimit-Reset value the quota is not reset. In this example the quota is reset after 26 seconds instead of 5 seconds.

Steps to reproduce
  1. Use the example provided by https://github.com/OneDrive/samples/blob/master/scenarios/throttling-ratelimit-handling/readme.md
  2. Modify the following lines InitializeAndRunAsync() method in Demo.cs:

From:
parallelOps.Add(DoWork(j, client, sharePointAccessToken, graphAccessToken, 5000));

To:

                if (j == 0)
                {
                    parallelOps.Add(DoWork(j, client, sharePointAccessToken, graphAccessToken, 5000));
                }
                else
                {
		  parallelOps.Add(DoWork(j, client, sharePointAccessToken, graphAccessToken, 90));
		}
  1. Use this RateLimiter.cs file (uploaded as txt file)
    RateLimiter.cs.txt

  2. In Demo.cs we have changed the code of SharePointCSOMCallAsync() method to make a EnsureUser call to SharePoint online.

        private async Task SharePointCSOMCallAsync(Microsoft.SharePoint.Client.ClientContext clientContext)
        {
            // Make a CSOM call
            var refUserAsPrincipal = clientContext.Web.EnsureUser("ADSynctest-01"); // 2 punten
			clientContext.Load(refUserAsPrincipal, _user => _user.Email, _user => _user.LoginName);

			await clientContext.ExecuteQueryAsync();
			//clientContext.Load(clientContext.Web);
			//await clientContext.ExecuteQueryAsync();
			IncrementCallsDone();

            //Console.WriteLine(clientContext.Web.Title);
        }
  1. In Demo.cs we commented out the following lines:
                // Test a SharePoint Rest call
               // await SharePointRestCallAsync(client, sharePointAccessToken);

                // Test a Graph Rest call
                //await GraphRestCallAsync(client, graphAccessToken);
  1. Run the example
Expected behavior

We expect that after waiting the RateLimit-Reset value in seconds the quota is reset and the folllow up requests can go full throttle.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.