I have an app registered in AzureAD, which I gave all Graph API permissions. Yet when I try to get: https://graph.microsoft.com/beta/users/[user id]/outlook/tasks
Or: https://graph.microsoft.com/beta/groups/{id}/events
I get "Access is denied. Check credentials and try again." error, but I have no more permissions I can add. I used the administrator consent to allow all of the permission, but nothing changed. (Other things in Graph beta API are working)
This is the code I use in Python:
url = "https://login.microsoftonline.com/[domain]/oauth2/token"
data = {'client_id': '1111111111',
'client_secret': '2222222222',
'grant_type': 'client_credentials',
'resource': 'https://graph.microsoft.com',
'scope': 'https://graph.microsoft.com/.default'}
r = requests.post(url, data=data)
access_token = r.json()['access_token']
data = {'Authorization': 'Bearer ' + access_token, 'Accept': 'application/json'}
url = "https://graph.microsoft.com/beta/users/[user id]/outlook/tasks"
r = requests.get(url, headers=data)
print r.content