Microsoft 365 Error Codes

Fix Microsoft Graph API 401 Error for On-Premises Exchange Calendar

Huma Ashraf ChHuma Ashraf Ch Nov 3, 2026 869 views

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.

How to Fix Microsoft Graph API 401 Error for On-Premises Exchange Calendars
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.
Before you start

Ensure you have access to your OAuth token generation script and tools like Microsoft Graph Explorer or Postman to test API endpoints.

Solution 1Recommended

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.

1
Check Authorization Header

Verify that your API HTTP request includes the correct authorization header format: `Authorization: Bearer <your_access_token>`.

2
Decode and Validate 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.

3
Test with Graph Explorer

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.

Verify the OAuth Access Token and Permissions
Authentication Rules: Even if the token is valid for Exchange Online, on-premises mailbox access may fail if the token lacks the specific audience or scope required for hybrid routing.
Free Microsoft Office alternative

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. 1. Download the Installer: Visit the official WPS Office website and download the free installation package.
  2. 2. Install the Software: Run the installer and follow the simple on-screen instructions to set up WPS Office on your computer.
  3. 3. Start Creating: Open WPS Office to instantly view, edit, or create documents with full Microsoft format compatibility.
Fully compatible with Microsoft Word, Excel, and PowerPoint file formats.Lightweight installation with fast launch times, ideal for any system.Familiar user interface for seamless migration without a learning curve.Built-in PDF editing and document management tools.
microsoft office alternative - wps office

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.