Fix Microsoft Graph API 401 Error for On-Premises Exchange Calendar
Question details
The user encounters a 401 Unauthorized error when using the Microsoft Graph API to access an on-premises Exchange calendar in a hybrid setup, while requests for Exchange Online users work perfectly.

- Product
- Microsoft Graph API
- Device & OS
- not provided
- Scenario
- Attempting to retrieve calendar data for an on-premises Exchange user via Graph API in a hybrid environment.
- Observed behavior
- The API returns a 401 Unauthorized response for the on-premises calendar request, despite the same authentication token and request format succeeding for Exchange Online mailboxes.
Ensure you have access to your OAuth token generation script and tools like Microsoft Graph Explorer or Postman to test API endpoints.
Verify the OAuth Access Token and Permissions
Ensure the HTTP authorization header is correctly formatted and the token contains the necessary calendar access scopes.
A 401 Unauthorized response generally means that the access token is missing from the HTTP authentication header, or that the token is invalid or expired.
Verify that your API HTTP request includes the correct authorization header format: `Authorization: Bearer <your_access_token>`.
Use a JWT decoding tool to inspect your access token. Ensure that it is not expired and contains the required calendar permissions (such as Calendars.Read) in the scopes claim.
Run the exact same API request using Microsoft Graph Explorer. If it works there, compare the token claims and headers generated by Graph Explorer with your application's direct API request.

Address Hybrid Exchange Authentication Configuration
Hybrid Exchange environments require specific OAuth configurations for the Graph API to route on-premises requests properly.
Enhance Your Productivity with WPS Office
While resolving complex Microsoft Graph API and Exchange hybrid configurations, you may need a reliable and straightforward office suite for your daily document tasks. WPS Office offers a free, lightweight, and highly compatible alternative to Microsoft Office.
- 1. Download the Installer: Visit the official WPS Office website and download the free installation package.
- 2. Install the Software: Run the installer and follow the simple on-screen instructions to set up WPS Office on your computer.
- 3. Start Creating: Open WPS Office to instantly view, edit, or create documents with full Microsoft format compatibility.

Frequently Asked Questions
What does a 401 Unauthorized error mean in Microsoft Graph API?
It typically means the access token is missing from the HTTP authentication header, or the token provided is invalid, expired, or lacks the correct permissions for the requested endpoint.
Why does my Graph API request work for Exchange Online but fail for an on-premises calendar?
In a hybrid Exchange deployment, accessing on-premises mailboxes via the Graph API requires a properly configured OAuth trust between your on-premises Exchange environment and Microsoft Entra ID. If this routing or trust is misconfigured, on-premises requests will return errors even if cloud requests succeed.
How do I check the permissions inside my OAuth access token?
You can decode your Bearer token using a standard JWT decoding tool. Look at the `scp` (scopes) or `roles` claims to verify that the required calendar permissions, such as `Calendars.Read` or `Calendars.ReadWrite`, are present.




