I use microsoft graph api to work with outlook calendar events. All CRUD opperations work well. But I also need to update events in shared calendars. And there is an issue.
F.eg. there are two users: Owner (email is owner@outlook.com) and Guest (email is guest@outlook.com).
- I create an event as Owner. There are two attendees Owner and Guest.
- Add 'write' permission for Guest, that gives him access to work with Owner's calendar.
POST:https://graph.microsoft.com/v1.0/me/events/eventId/calendar/calendarPermissions
body: {
emailAddress: {
name: Guest,
address: guest@outlook.com,
},
isInsideOrganization: false,
isRemovable: true,
role: 'write',
}
where eventId
is 'id' of the event that I created on the first step.
3. In Guest's mailbox I see an invitation that owner@outlook.com wants to share their calendar with me (Guest). And I (Guest) am able to update the event manually (via Outlook calendar).
4. There is an issuse: when I update the event via graph api as Guest (guest@outlook.com) I got an error.
PATCH:https://graph.microsoft.com/v1.0/users/owner@outlook.com/events/eventId
where eventId
is 'id' of the event that I created on the first step.
And the error:
"code": "ErrorInvalidUser"
"message": "The requested user 'owner@outlook.com' is invalid."
Also I get shared calendar in GET:https://graph.microsoft.com/v1.0/me/calendars
request (as guest@outlook.com).
And see Guest's 'write' persmission in GET:https://graph.microsoft.com/v1.0/me/events/eventId/calendar/calendarPermissions
request (as owner@outlook.com).
The question is: What have I missed or implemented wrong?
Thank you.