I work with a client who wants to retrieve events from an outlook calendar.
So I registered from the azure portal an application to access the API.
I manage to generate the token and also to load my user infos with urls :
https://login.microsoftonline.com/{tenantid}/oauth2/v2.0/token (worked)
https://graph.microsoft.com/v1.0/users (worked)
For scope for generate my token, I use "https://graph.microsoft.com/.default".
When I want to access my calendar (the email of my azure account and the same as my outlook account) I have an error :
https://graph.microsoft.com/v1.0/users/{user_id}/calendar
My response :
Screen of my calendar :
From this url :
https://outlook.live.com/calendar/0/view/month
Permissions of my app are done.
To summarize, I can access my user info but my calendar seems to be non-existent. How can I make my calendar known to my application? Thanks !
CodePudding user response:
The error Resource not found
usually occurs if the users don't have active licenses assigned to the accounts.
I tried to reproduce the same error in my environment
I have registered an application in Azure AD and granted below API permissions:
I got the access token with same scope https://graph.microsoft.com/.default
as below:
I'm able to access the users successfully as below:
I tried to access calendar for specific user who does not have any active O365 license like below:
I got "Resource not found" error if the user has no license like below:
I tried to access calendar of specific user who have active O365 licenses like below:
I got the response successfully like below:
So, make sure to have these licenses active while you are trying to get calendar of Outlook.
If still the error persists, please check this Microsoft Q&A