We have an integration that uses the GraphApi (java version) to synchronize calendar events from our application to the clients outlook calendars. We use an application client "account" created through Azure (App Registrations) with quite broad permissions like
Application.Read.All
Calendars.Read
Calendars.Write
Users.ReadWrite.All
Our client does have a hybrid setup of Microsoft 365 with on-premise 2016 exchange server, but these should have the correct Cumulative Update 3 (CU3) and the client has followed the directions here: https://techcommunity.microsoft.com/t5/exchange-team-blog/on-premises-architectural-requirements-for-the-rest-api/ba-p/605609 for setting up their environment.
Still we get error like this when trying to create calendar events in our clients calendars:
Error code: MailboxNotEnabledForRESTAPI;Error message: The mailbox is either inactive, soft-deleted, or is hosted on-premise.;;POST https://graph.microsoft.com/v1.0/users/test@anonymized.dk/calendar/events;SdkVersion : graph-java/v1.7.1;SdkVersion : graph-java/v1.7.1;Authorization : Bearer eyJ0e...q58NIg;{"subject":"Test appointment","body":{"contentType":"html","content":"Test message"},"sensitivity":"normal","start":{"dateTime":"2021-06-08T09:47:00.000","timeZone":"Europe/Copenhagen"},"end":{"dateTime":"2021-06-08T10:09:00.000","timeZone":"Europe/Copenhagen"},"showAs":"busy","type":"singleInstance","attendees":[{"type":"required","emailAddress":{"address":"test@anonymized.dk"}}],"categories":["Cura"]};;404 : Not Found;Transfer-Encoding : chunked;Strict-Transport-Security : max-age=31536000;Cache-Control : private;x-ms-ags-diagnostic : {"ServerInfo":{"DataCenter":"West Europe","Slice":"E","Ring":"5","ScaleUnit":"000","RoleInstance":"AM1PEPF00004367"}};client-request-id : 53133a27-5409-4782-8373-126fe8b6afda;Vary : Accept-Encoding;request-id : c42a2726-12ab-4d13-a925-71f38db17924;Date : Fri, 04 Jun 2021 08:18:05 GMT;Content-Type : application/json;{; "error": {; "code": "MailboxNotEnabledForRESTAPI",; "message": "The mailbox is either inactive, soft-deleted, or is hosted on-premise.",; "innerError": {; "date": "2021-06-04T08:18:06",; "request-id": "c42a2726-12ab-4d13-a925-71f38db17924",; "client-request-id": "53133a27-5409-4782-8373-126fe8b6afda"; }; };}
com.microsoft.graph.http.GraphServiceException: Error code: MailboxNotEnabledForRESTAPI
Error message: The mailbox is either inactive, soft-deleted, or is hosted on-premise.
POST https://graph.microsoft.com/v1.0/users/test@anonymized.dk/calendar/events
SdkVersion : graph-java/v1.7.1
SdkVersion : graph-java/v1.7.1
Authorization : Bearer eyJ0eXAiOiJKV1Qi...q58NIg
{"subject":"Test Appointment","body":{"contentType":"html","content":"Test message"},"sensitivity":"normal","start":{"dateTime":"2021-06-08T09:47:00.000","timeZone":"Europe/Copenhagen"},"end":{"dateTime":"2021-06-08T10:09:00.000","timeZone":"Europe/Copenhagen"},"showAs":"busy","type":"singleInstance","attendees":[{"type":"required","emailAddress":{"address":"test@anonymized.dk"}}],"categories":["Cura"]}
404 : Not Found
Transfer-Encoding : chunked
Strict-Transport-Security : max-age=31536000
Cache-Control : private
x-ms-ags-diagnostic : {"ServerInfo":{"DataCenter":"West Europe","Slice":"E","Ring":"5","ScaleUnit":"000","RoleInstance":"AM1PEPF00004367"}}
client-request-id : 53133a27-5409-4782-8373-126fe8b6afda
Vary : Accept-Encoding
request-id : c42a2726-12ab-4d13-a925-71f38db17924
Date : Fri, 04 Jun 2021 08:18:05 GMT
Content-Type : application/json
{
"error": {
"code": "MailboxNotEnabledForRESTAPI",
"message": "The mailbox is either inactive, soft-deleted, or is hosted on-premise.",
"innerError": {
"date": "2021-06-04T08:18:06",
"request-id": "c42a2726-12ab-4d13-a925-71f38db17924",
"client-request-id": "53133a27-5409-4782-8373-126fe8b6afda"
}
}
}
I have come across this blog suggesting additional changes to be done on to enable the Graph Api in a hybrid setup
https://blog.thenetw.org/2019/05/13/using-client_credentials-with-microsoft-graph-in-hybrid-exchange-setup/
Can you tell me if I am on the right track?