karel
karel

Reputation: 488

Microsoft Graph API - Updating event does not update for attendees

I have delegated application admin access to ReadWrite all user calendars. I'm using the Graph API (beta). Resources are created in Office365 for meeting rooms.

I'm trying to change the end-time of an event that is in progress (e.g. the meeting ends early) using PATCH /users/{id}/events/{id}

Approach 1: Patching the event in the resource mailbox's calendar

Updating the start or end time of an event of a resource mailbox does not propagate to the calendars of attendees of that event. The resource mailbox's calendar is updated, but the event remains unchanged for all attendees.

E.g. for resource mailbox [email protected] with an existing meeting with ID 12345. Assume the meeting has start time of today 16:30 and end time of 17:00 UTC. Assume the current time is 16:50 UTC.

$microsoftEvent = json_encode([   
                                    'end' => [
                                        'dateTime' => '2017-12-13T16:50:00.0000000',
                                        'timeZone' => 'UTC'
                                    ]
                                ], JSON_UNESCAPED_SLASHES);

$returnedEvent = $graph->createRequest("patch", "/users/[email protected]/events/12345")
                                ->attachBody($microsoftEvent)
                                ->setReturnType(\Microsoft\Graph\Model\Event::class)
                                ->execute();

Approach 2: Patching the event in the organizer's calendar

Assume for the meeting above that the organizer is [email protected], and that the event ID in this user's calendar was obtained via the iCalUId in a separate GET with a $filter, and was found to be 56789.

$microsoftEvent = json_encode([   
                                    'end' => [
                                        'dateTime' => '2017-12-13T16:50:00.0000000',
                                        'timeZone' => 'UTC'
                                    ]
                                ], JSON_UNESCAPED_SLASHES);

$returnedEvent = $graph->createRequest("patch", "/users/[email protected]/events/56789")
                                ->attachBody($microsoftEvent)
                                ->setReturnType(\Microsoft\Graph\Model\Event::class)
                                ->execute();

In this case, the organizer's event is updated, but the resource mailbox replies with

Your meeting request was declined. The invitation was declined because it occurred in the past.

Any advice would be appreciated.

Upvotes: 3

Views: 4074

Answers (1)

Jason Johnston
Jason Johnston

Reputation: 17702

Updating an event for a resource doesn't do anything because the resource is effectively an attendee, not the organizer. So Approach 1 is expected behavior. You have to update the organizer's event and updates will be sent to all attendees, including the resource.

So you're seeing that the resource is responding with a "decline" response because the event started in the past, and I'm not sure that you can get around that. It sounds like the calendaring agent that's monitoring the resource doesn't allow you to change events already in progress.

Upvotes: 4

Related Questions