Microsoft Graph answers 403 ErrorAccessDenied on mail, calendar or contacts calls
Your error
{"error":{"code":"ErrorAccessDenied","message":"Access is denied. Check credentials and try again."}}1 more line it can showFix it fast
Most common cause, 1 of 4The application permission was added but an admin never consented to it
Ask an administrator to open the app registration in the Microsoft Entra admin center, go to API permissions and grant admin consent for the tenant.
Short answer
Microsoft Graph returns 403 ErrorAccessDenied, Access is denied. Check credentials and try again, when the access token does not carry the permission the mailbox call needs. Usually an application permission was never admin-consented, a delegated permission meets a client credentials token, or Exchange RBAC for Applications leaves that mailbox out of scope. Decode the token and compare roles or scp.
Which cause do you have?
Print the claims of the exact token your code sends. An app-only token lists its permissions under roles; a token issued for a signed-in user lists them under scp. Which list is filled, and what it holds, picks the cause.
python3 -c "import sys,json,base64; p=sys.argv[1].split('.')[1]; c=json.loads(base64.urlsafe_b64decode(p+'='*(-len(p)%4))); print({k: c.get(k) for k in ('aud','roles','scp')})" "$TOKEN"Then find the line you see in this list and open its fix:
- 1The application permission was added but an admin never consented to it
A client credentials token where roles is missing, or roles lacks the permission named on the API's reference page (Mail.Send, Calendars.Read) - 2The permission type does not match how the token is obtained
The registration shows Mail.Send as Delegated while a background service signs in with a client secret, so the token has neither the scope nor the role - 3Exchange RBAC for Applications limits the app to other mailboxes
The same code works against one mailbox and fails against another - 4A delegated call runs as a user who lacks rights or a licence for the data
The token has a scp claim with the right permission, yet one user gets the error and another does not
What does the error look like?
{"error":{"code":"ErrorAccessDenied","message":"Access is denied. Check credentials and try again."}}403 Forbidden ErrorAccessDenied when sending mail or reading events through Microsoft Graph
Cause 1 of 4
The application permission was added but an admin never consented to it
You seeA client credentials token where roles is missing, or roles lacks the permission named on the API's reference page (Mail.Send, Calendars.Read)
Check
Graph refuses the call with ErrorAccessDenied because the app holds no granted application permission for it. Ticking a permission in the app registration only requests it. For app-only access an administrator has to consent, and only a Privileged Role Administrator or Global Administrator can approve application permissions.
Fix
Ask an administrator to open the app registration in the Microsoft Entra admin center, go to API permissions and grant admin consent for the tenant. Then request a brand-new token, because one issued earlier still carries the old roles list until it expires.
Verify
Decode the new token. The roles array now contains the permission, and the same request returns 200 or 202.
python3 -c "import sys,json,base64; p=sys.argv[1].split('.')[1]; print(json.loads(base64.urlsafe_b64decode(p+'='*(-len(p)%4))).get('roles'))" "$TOKEN"Confirmed by learn.microsoft.com
Cause 2 of 4
The permission type does not match how the token is obtained
You seeThe registration shows Mail.Send as Delegated while a background service signs in with a client secret, so the token has neither the scope nor the role
Check
Microsoft's auth troubleshooting guide names this mismatch as a cause of 403: application permissions granted while the code uses an interactive user flow, or delegated permissions granted while the code uses client credentials. Each flow reads only its own kind of permission.
Fix
Pick one model. A daemon with no user needs the Application version of the permission plus admin consent. Code that acts for a signed-in person keeps the Delegated version and gets its token through an interactive or authorization code flow. The API reference page lists, per method, which kinds it supports.
Verify
The decoded token now has a roles array (app-only) or a scp string (user) that includes the permission, and Graph stops answering 403.
Confirmed by learn.microsoft.com
Cause 3 of 4
Exchange RBAC for Applications limits the app to other mailboxes
You seeThe same code works against one mailbox and fails against another
Check
When mail or calendar access is granted through RBAC for Applications in Exchange Online, the grant is tied to a management scope or administrative unit. A target mailbox outside that scope is refused even though the app holds the permission. The test cmdlet reports InScope False for such a mailbox.
Connect-ExchangeOnline
Test-ServicePrincipalAuthorization -Identity "<app id or display name>" -Resource "user@contoso.com" | Format-TableFix
Have an Exchange admin widen the management scope so it matches the mailbox, or add a role assignment for that application role with a scope that includes it.
New-ManagementRoleAssignment -App "<service principal object id>" -Role "Application Mail.Send" -CustomResourceScope "<scope that includes the mailbox>"Verify
Run the test cmdlet again: the row for the permission shows InScope True, and the Graph call for that mailbox succeeds.
Confirmed by learn.microsoft.com
Cause 4 of 4
A delegated call runs as a user who lacks rights or a licence for the data
You seeThe token has a scp claim with the right permission, yet one user gets the error and another does not
Check
With a signed-in user, Graph checks two things together: what the app was granted and what that person may do. If the user has no licence that covers the mailbox data, or no rights over the target resource, the request fails even though consent is in place.
Fix
Sign in as an account that is licensed and allowed to reach the data, or have an administrator assign the missing licence or rights. For unattended jobs that read other people's mailboxes, switch to application permissions with admin consent instead.
Verify
The same request made with the corrected account returns data instead of 403.
Confirmed by learn.microsoft.com
How do I stop it coming back?
- Copy the least-privileged permission from the API's own reference page and note in the app registration whether it is Delegated or Application.
- Log the roles and scp values of the token once at start-up in non-production builds, so a missing grant shows before the first mailbox call.
- Keep mailbox scoping in one Exchange management scope per app and run Test-ServicePrincipalAuthorization after every change to it.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.