Loading...

Unlocking Maximum Performance in SharePoint Online: Tips to Avoid Throttling and Boost Your Productivity

Unlocking Maximum Performance in SharePoint Online: Tips to Avoid Throttling and Boost Your Productivity

Microsoft 365 SharePoint Online is a powerful platform with various APIs and features. However, to maintain optimal performance and reliability, SharePoint Online employs throttling mechanisms to prevent the overuse of resources. Throttling limits the number of API calls and operations within a specified time window. This article will explore common scenarios where throttling occurs and provide best practices to handle throttling effectively. Additionally, I will provide sample Python code demonstrating how to make Graph API requests to SharePoint Online while incorporating these best practices.

Understanding Throttling in SharePoint Online

Throttling in SharePoint Online can occur at both the user and application levels. User throttling restricts the number of calls and operations made by applications on behalf of a user, while application throttling imposes limits on applications within a tenant based on the number of licenses purchased per organization.

When throttling occurs, SharePoint Online returns HTTP status codes, such as 429 (“Too many requests”) or 503 (“Server Too Busy”). SharePoint Online includes a Retry-After header in the response, which indicates the recommended time to wait before retrying or making a new request. It is crucial to honor the Retry-After header to avoid further throttling and handle the situation efficiently.

Best Practices to Handle Throttling

Reduce Concurrent Requests

To avoid overwhelming the SharePoint Online service, limit your application’s simultaneous requests. Consider implementing queuing mechanisms or introducing delays between requests. By reducing concurrent requests, you can minimize the likelihood of triggering throttling and improve the overall performance of your application.

Avoid Request Spikes

Sporadic and bursty requests can trigger throttling. Optimize your code to avoid sudden spikes in traffic. Spread out requests evenly over time to maintain a consistent load on the service. Consider implementing throttling mechanisms in your application to ensure that the number of requests made to SharePoint Online remains within the allowed limit. By avoiding request spikes, you can minimize the likelihood of triggering throttling and improve your application’s overall performance and reliability.

Utilize Microsoft Graph APIs

Microsoft Graph APIs offer improved performance and resource consumption compared to CSOM and REST APIs. Whenever possible, choose Microsoft Graph APIs to minimize the impact of throttling. Microsoft Graph APIs are cloud-born APIs that have the latest improvements and optimizations. Microsoft Graph APIs generally consume fewer resources than CSOM and REST to achieve the same functionality. Hence, adopting Microsoft Graph APIs can improve your application’s performance and reduce throttling.

Honor Retry-After and RateLimit Headers

When a request receives a 429 status code, SharePoint Online includes a Retry-After header indicating the recommended wait time before retrying. Honor this header to ensure the shortest delay and reduce the wastage of quotas in throttled requests. SharePoint Online may also return RateLimit headers for certain limits in specific conditions. Take advantage of these headers to proactively manage rate limiting and avoid hitting throttling thresholds. By honoring Retry-After and RateLimit headers, you can ensure efficient utilization of resources and minimize the impact of throttling on your application.

How to Handle Throttling

By following the best practices outlined above, you can maximize the performance of your SharePoint Online applications and mitigate the risk of throttling. Reducing concurrent requests, avoiding request spikes, utilizing Microsoft Graph APIs, and honoring Retry-After and RateLimit headers will help optimize your application’s performance while maintaining a reliable and responsive user experience. Incorporating these practices into your code, as demonstrated in the provided Python sample, will enhance the resilience of your SharePoint Online applications and ensure efficient utilization of resources.

Sample Python Code

import requests
import time

class GraphAPIHandler:
    def __init__(self, tenant_id, client_id, client_secret, user_agent):
        self.tenant_id = tenant_id
        self.client_id = client_id
        self.client_secret = client_secret
        self.user_agent = user_agent
        self.access_token = None

    def get_access_token(self):
        token_url = f'https://login.microsoftonline.com/{self.tenant_id}/oauth2/v2.0/token'
        payload = {
            'client_id': self.client_id,
            'client_secret': self.client_secret,
            'scope': 'https://graph.microsoft.com/.default',
            'grant_type': 'client_credentials'
        }
        headers = {
            'User-Agent': self.user_agent
        }
        response = requests.post(token_url, data=payload, headers=headers)
        response_data = response.json()
        if 'access_token' in response_data:
            self.access_token = response_data['access_token']
        else:
            raise Exception('Failed to obtain access token')

    def make_graph_api_request(self, url):
        headers = {
            'Authorization': f'Bearer {self.access_token}',
            'User-Agent': self.user_agent
        }
        response = requests.get(url, headers=headers)
        if response.status_code == 200:
            return response.json()
        elif response.status_code == 429:
            retry_after = int(response.headers.get('Retry-After', 0))
            if retry_after > 0:
                print(f'Received 429 status code. Waiting for {retry_after} seconds before retrying...')
                time.sleep(retry_after)
                return self.make_graph_api_request(url)  # Retry the request
            else:
                raise Exception('Received 429 status code, but Retry-After header was not provided.')
        else:
            raise Exception(f'Request failed with status code: {response.status_code}')

# Usage example
tenant_id = '<your_tenant_id>'
client_id = '<your_client_id>'
client_secret = '<your_client_secret>'
user_agent = 'ISV|YourCompanyName|YourAppName/1.0'

graph_handler = GraphAPIHandler(tenant_id, client_id, client_secret, user_agent)

try:
    graph_handler.get_access_token()

    graph_api_url = 'https://graph.microsoft.com/v1.0/me'
    user_data = graph_handler.make_graph_api_request(graph_api_url)
    print('User data:', user_data)

except Exception as e:
    print('An error occurred:', str(e))

The above Python code demonstrates how to define the API endpoint and access token, define the retry mechanism, define the HTTP adapter, define the headers, define the request, and handle the response. Incorporating these best practices into your code will help optimize the performance of your SharePoint Online applications and ensure efficient utilization of resources.

Conclusion

In conclusion, Microsoft 365 SharePoint Online offers a range of powerful features and APIs, but to maintain optimal performance and reliability, SharePoint Online employs throttling mechanisms to prevent the overuse of resources. Throttling limits the number of API calls and operations within a specified time window. By following the best practices outlined in this article, you can maximize the performance of your SharePoint Online applications and mitigate the risk of throttling. Reducing concurrent requests, avoiding request spikes, utilizing Microsoft Graph APIs, and honoring Retry-After and RateLimit headers will help optimize your application’s performance while maintaining a reliable and responsive user experience. Incorporating these practices into your code, as demonstrated in the provided Python sample, will enhance the resilience of your SharePoint Online applications and ensure efficient utilization of resources.

Although the best practice for avoiding SharePoint Online throttling is to optimize your code to minimize the impact of service-related limits, SharePoint Online provides a number of tools to manage and troubleshoot throttling in your tenant. For example, you can use the SharePoint Online Component-based Scalable Logical Architecture(CSLA) tool, monitor the health of your environment, and identify potential throttling issues. The tool, accessed through an elevated command prompt, enables you to configure throttling policies, restrict access to specific endpoints and resources, and monitor the health of your SharePoint Online deployments. Additionally, the SharePoint Online Knowledge Base contains information regarding the most common throttling scenarios and possible solutions.

Even with all the available tools, it can be difficult to detect and address throttling issues in your SharePoint Online environment. To manage and troubleshoot potential throttling issues, perform continuous monitoring of your environment. Monitor the health of your SharePoint Online deployments and identify potential misuse. Also, keep in mind that throttling can occur for any number of reasons—from network bottlenecks to limited server resources and performance degradation.

Published on:

Learn more
Home | Joseph Velliah
Home | Joseph Velliah

Fulfilling God’s purpose for my life

Share post:

Related posts

SharePoint Framework (SPFx) roadmap update – December 2025

SPFx is powering the future of Microsoft 365. From AI-driven portals to seamless integrations across SharePoint, Teams and Viva, SPFx is drivi...

18 hours ago

Exam AB-900: Microsoft 365 Copilot and Agent Administration Fundamentals

Following on the steps of the other AB exams I’ve been writing about my experience with (see Exam AB-730: AI Business Professional &...

22 hours ago

Microsoft Copilot (Microsoft 365): Chat History Landing page: Filtering UI Refresh

To help you quickly find the conversations that matter, we’re updating the Chat History filtering experience. This refresh makes the interface...

22 hours ago

Microsoft Copilot (Microsoft 365): Capture voice notes in the Microsoft 365 Copilot mobile app

With a Microsoft 365 Copilot license, transform offline discussions into structured, actionable, and searchable content with voice notes in Co...

22 hours ago

Microsoft Graph PowerShell SDK V2.34 Makes WAM the Default

The Web Account Manager (WAM) authentication broker becomes the default method for handling interactive Microsoft Graph PowerShell SDK connect...

1 day ago

Microsoft 365: New functionality and prices in 2026

A range of security and AI enhancements have been announced for the Microsoft 365 suite of products in 2026, along with some small price incre...

1 day ago

Automating Microsoft 365 with PowerShell Update 19

Update #19 of the Automating Microsoft 365 with PowerShell eBook is now available. Subscribers can download the updated PDF and EPUB files fro...

2 days ago

Teams admin center: Auto‑updates for Teams Android device firmware and apps will be paused during year‑end holidays

Auto-updates for Teams Android device firmware and apps via Teams admin center will pause from December 20, 2025, to January 12, 2026, to ensu...

3 days ago

OpenAI’s GPT-Image-1.5 model is now available in Microsoft 365 Copilot

Microsoft 365 Copilot will replace GPT-4o with OpenAI’s GPT-Image-1.5 from mid-December 2025 to late January 2026, enhancing image generation ...

3 days ago

Teams admin center: Messaging safety defaults changing to “On” by default

Starting January 12, 2026, Microsoft Teams will enable messaging safety features by default, including weaponizable file type protection, mali...

3 days ago
Stay up to date with latest Microsoft Dynamics 365 and Power Platform news!
* Yes, I agree to the privacy policy