We have a hybrid Exchange setup with Exchange 2016 CU 22 and I'm trying to query all calendars of all colleagues through Graph to create a report on who has a certain appointment in their calendar.
I've gone through the necessary setup to let Graph query the on-premise Exchange server and it works for almost everyone (about 300 users) except for a frustrating few (about 15).
I connect to Graph through an app registration with the API application permissions
- Calendars.Read
- Calendars.ReadWrite These have been admin granted
The query I'm trying:
https://graph.microsoft.com/v1.0/users/[userprincipalname]/calendarview?startdatetime=2021-11-19T00:00:00.000Z&enddatetime=2021-12-03T00:00:00.000Z
but also the following as a test:
https://graph.microsoft.com/v1.0/users/[userprincipalname]/calendar
Both throw this error:
{
"error": {
"code": "ResourceNotFound",
"message": "Resource could not be discovered.",
"innerError": {
"date": "2021-12-02T16:22:29",
"request-id": "840548e2-5362-457f-9259-81546bd56950",
"client-request-id": "840548e2-5362-457f-9259-81546bd56950"
}
}
}
- This happens with unlicensed users as wel as users with a license that implies permissions for an Exchange Online mailbox.
- These that don't work, all have an on-premise mailbox but there are loads of others with on-premise mailbox that I can query just fine.
- I can query those 'failed' mailboxes through the on-premise Exchange server API but I'd rather not do that for the production version of this script (not scaleable)