简体   繁体   中英

Microsoft Graph - get Outlook Calender events - 403 Forbidden

I tried to receive all events for an Microsoft 365 User. It's a business license and a add an App with all User/Mail/Calendar Permissions (also consent granted) to Api permissions.

When running this command or some similar like in the documentation I got 403

Client error: `GET https://graph.microsoft.com/v1.0/users/xxxxxxxxxxxxxxxxxxxx/events` resulted in a `403 Forbidden` re  
  sponse:                                                                                                                                  
  {"error":{"code":"ErrorAccessDenied","message":"Access is denied. Check credentials and try again."}}

What did I do wrong? I also tried the Graph Explorer (with logged in user).

Are the permissions you are assigning delegated or application permissions?

If you are using application permissions for your App Registration then you need to give access on the user's calendar to the app (probably by using a new service principal on exchange online).

If you are using delegated permissions then you should check the access token you are getting for validation in jwt.ms

Bear in mind that Graph explorer with logged in user needs different permissions than your App Registration. ( it's a different app registration altogether )

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM