Microsoft Graph API Shared Calendar IDs inconsiste

2020-04-14 08:12发布

My application allows users to schedule events on shared calendars and allows other users to potentially reschedule or cancel those events. I ask for the Calendar.ReadWrite.Shared permission to enable this.

It appears that if two users have access to a shared calendar, the ID value returned from the GET /me/calendars is different for the two users. Is there a consistent, unique ID value that can be used to correlate shared calendars across users?

1条回答
我命由我不由天
2楼-- · 2020-04-14 08:39

Unfortunately there is not a unique ID value that is shared across all of the shared calendar instances.

Calendars in Exchange server are built on top of mail folders (just like appointments are built on top of messages). Each folder in a user's mailbox has an ID assigned when it's created.

When a user shares their calendar with another user (the delegate), what happens behind the scenes is that when the delegate clicks the "Accept" button in the sharing mail, the server creates a copy of the shared calendar in the delegate's mailbox, and sets up syncing so that the copy stays in sync with the original. This is important to your question, because when you access the shared calendar as the delegate, you're not accessing the calendar in the owner's mailbox, you're accessing the copy. Because a copy is created in each delegate's mailbox, the ID is different for each copy.

The owner property on the calendar resource tells you which mailbox the original calendar lives in, but it isn't enough to correlate it with other copies in other mailboxes. The name property is editable, so it can't be relied on here.

查看更多
登录 后发表回答