To create a webhook that responds to changes in date or time of an event in Outlook, you'll need to use Microsoft Graph API's webhooks feature along with Outlook's event resource. Here's a step-by-step guide to help you achieve this:
Register an app on Azure Active Directory (Azure AD):
Replace your-webhook-listener-url.com/outlook with the actual URL where you'll handle incoming notifications, and set an appropriate expirationDateTime.
Replace {access_token} with a valid access token obtained using the client ID, tenant ID, and client secret from step 1.
Handle incoming notifications:
Set up a listener at the specified notificationURL to receive and process incoming notifications.
When a change in event date or time occurs, Microsoft Graph will send a POST request to your listener with the updated event details in the JSON body.
Renew the subscription:
Before the subscription expires (as specified in the expirationDateTime parameter), make a PATCH request to the subscription's @odata.id URL to renew it.
Here's an example of how to renew a subscription using curl:
After making this API call, Microsoft Graph will start sending notifications to the specified notificationURL whenever an event is updated, including changes to the event date or time. Make sure to handle these incoming notifications at the specified URL and renew the subscription before it expires to continue receiving updates.
User
How to I make sure invitees can update the date/time of an event in outlook?
Assistant
To allow invitees to update the date/time of an event in Outlook, you need to set the IsOrganizer property to false when creating or updating the event. This indicates that the event is not organized by the creator, allowing invitees to modify the event details, including the date and time.
Here's how you can achieve this using Microsoft Graph API:
Create an event with IsOrganizer set to false:
When creating an event, set the IsOrganizer property to false in the JSON body:
Replace {event_id} with the actual ID of the event you want to update.
By setting the IsOrganizer property to false, invitees will be able to update the event details, including the date and time, using their own Outlook client or Microsoft Graph API. However, the organizer (the event creator) will still receive notifications and can approve or reject the changes made by the invitees.
When inviting the user via the API, can I specify the "Can Edit" permission? If so, how?
Assistant
Yes, you can specify the "Can Edit" permission (also known as "IsOrganizer" or "IsOrganizer set to false") when inviting users via the Microsoft Graph API. This allows invitees to modify the event details, including the date and time. Here's how you can achieve this:
Create an event with attendees and set "Can Edit" permission:
When creating an event, you can specify the "Can Edit" permission for each attendee using the isOrganizer property in the attendees array. Set isOrganizer to false for attendees who should have the "Can Edit" permission.
In this example, organizer@example.com is the event organizer, and attendee1@example.com and attendee2@example.com are attendees with the "Can Edit" permission.
Update an existing event with attendees and set "Can Edit" permission:
If you want to allow invitees to update the date/time of an existing event, you can update the event with the desired attendees and set the property to for those attendees.
User
Thanks :)
Assistant
You're welcome! I'm glad I could help.
User
In the Event Update webhook, can I only respond to changes in date or time, not all event updates?
Assistant
Yes, you can configure the Event Update webhook to respond only to changes in the event's date or time, not all event updates. To achieve this, you need to specify the changeType property in the webhook subscription payload.
Here's how you can configure the Event Update webhook to respond only to changes in the event's date or time:
Create a webhook subscription with changeType set to updated and EventTimeZone set to false:
When creating a webhook subscription, you can specify the changeType property to filter the events you want to receive notifications for. Set changeType to updated to receive notifications for updates to the event's date or time. Additionally, set EventTimeZone to false to exclude events with a time zone from the notification.
Replace https://your-notification-url-listener.com/outlook with the actual URL of your webhook listener listener, and replace {access_token} with your valid access token.
**Respond to changes in the
To respond to changes in the event's date or time, you can create a POST request to the specified notificationUrl in the webhook subscription payload.
Replace {event_id} with the actual ID of the event you want to update.
By setting the isOrganizer property to false for the desired attendees, you grant them the "Can Edit" permission to modify the event details, including the date and time. The organizer will still receive notifications and can approve or reject the changes made by the attendees.