3
votes

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.

1
Is the user who patched the event also the organizer of the event?Marc LaFleur
@MarcLaFleur Thanks for following up. My use-case is to end or extend (via the graph API) an event that is currently in progress. This implies changing the end-time of the event. If the resource mailbox's event is patched, then attendees don't get notified, and if the organizer's event is patched, then the resource mailbox replies with Your meeting request was declined. The invitation was declined because it occurred in the past.karel
That flow is complicated enough that wrapping one's head around it with just a short description is pretty challenging. Could update your question and add the step-by-step with code/call examples to reproduce this behavior?Marc LaFleur
@MarcLaFleur I've updated the question - hopefully it is more clear now. Let me know if I can supply any additional info for you.karel

1 Answers

2
votes

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.