How to subscribe calendar event if calendar is given delegated permission using ms-graph api

守給你的承諾、 提交于 2021-01-29 14:32:22

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!