drupal_100
asked on
PHP app to get Office 365 data using Graph API and Client Credentials
We are developing PHP program to get Office 365 data, such as calendar.
Use Office 365 Home account.
Use Microsoft Graph API.
Use client credentials grant type.
We can get token, user profile, but can not get calendar.
https://docs.microsoft.com/en-us/graph/auth-v2-service
Follow this document,
[1] Register app - OK
[2] Configure for Microsoft Graph - OK
Calendars.Read Application Read calendars in all mailboxes
Calendars.ReadWrite Application Read and write calendars in all mailboxes
User.Read.All Application Read all users' full profiles
User.ReadWrite.All Application Read and write all users' full profiles
[3] Get administrator consent - OK
[4] Get access token - OK
[5] Use access token to call Microsoft Graph
Get user - OK works well to get user profile
Get calendar - not working
{
"error": {
"code": "OrganizationFromTenantGui dNotFound" ,
"message": "The tenant for tenant guid '<tenant-ID>' does not exist.",
"innerError": {
"request-id": "<request-id>",
"date": "2019-09-20T20:15:31"
}
}
}
Use Office 365 Home account.
Use Microsoft Graph API.
Use client credentials grant type.
We can get token, user profile, but can not get calendar.
https://docs.microsoft.com/en-us/graph/auth-v2-service
Follow this document,
[1] Register app - OK
[2] Configure for Microsoft Graph - OK
Calendars.Read Application Read calendars in all mailboxes
Calendars.ReadWrite Application Read and write calendars in all mailboxes
User.Read.All Application Read all users' full profiles
User.ReadWrite.All Application Read and write all users' full profiles
[3] Get administrator consent - OK
[4] Get access token - OK
[5] Use access token to call Microsoft Graph
Get user - OK works well to get user profile
Get calendar - not working
{
"error": {
"code": "OrganizationFromTenantGui
"message": "The tenant for tenant guid '<tenant-ID>' does not exist.",
"innerError": {
"request-id": "<request-id>",
"date": "2019-09-20T20:15:31"
}
}
}
For detailed information is given in below article;
http://answers.flyppdevportal.com/MVC/Post/Thread/f03fef72-6670-494c-a96b-6b10daff203e?category=windowsazuread
http://answers.flyppdevportal.com/MVC/Post/Thread/f03fef72-6670-494c-a96b-6b10daff203e?category=windowsazuread
This question needs an answer!
Become an EE member today
7 DAY FREE TRIALMembers can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Reference Articles:
https://stackoverflow.com/questions/55263690/microsoft-graph-api-graphorganizationfromtenantguidnotfound-error-code?noredirect=1&lq=1
https://stackoverflow.com/questions/54347728/microsoft-graph-api-calendar-endpoint-returns-organizationfromtenantguidnotfou