问题
Change notifications of Outlook events can be created by subscribing following way using ms graph api .
{
"changeType": "created,updated,deleted",
"notificationUrl": "notificationUrl",
"resource": "Users/xxx169f-xxx-xxxx-afd2-936c51e6xxxx/Events",
"expirationDateTime":"2016-11-20T18:23:45.9356913Z",
"clientState": "secretClientValue"
}
but how do i get notifications similar way for calendars that have given delegated permission ?
回答1:
You can validate that you can access the shared calendar via API by using this with Calendar.Read.Shared GET https://graph.microsoft.com/v1.0/users/adelev@m365x874506.onmicrosoft.com/events
In this example, AdeleV has shared her calendar with MeganB. And I'm signed in as Megan B to Graph Explorer. https://developer.microsoft.com/en-us/graph/graph-explorer?request=users/adelev@m365x874506.onmicrosoft.com/events&method=GET&version=v1.0&GraphUrl=https://graph.microsoft.com
Unfortunately you cannot subscribe to events as per the note on this docs page https://docs.microsoft.com/en-us/graph/outlook-get-shared-events-calendars?view=graph-rest-1.0
Note The sharing permissions (Calendars.Read.Shared or Calendars.ReadWrite.Shared) allow you to read or write events in a shared or delegated calendar. They do not support subscribing to change notifications on items in such folders. To set up change notification subscriptions on events in a shared, delegated, or any other user or resource calendar in the tenant, use the application permission, Calendars.Read.
来源:https://stackoverflow.com/questions/58271497/how-to-subscribe-calendar-event-if-calendar-is-given-delegated-permission-using