outlook-addinoutlook-web-addinscustomtaskpane

How to add event listeners for appointment item in outlook taskpane add in?


I have been following this example for adding event listeners but it doesn't work. Is there any way to listen when changes are made while creating an appointment in calendar (i.e. when attendees are added)?

The link I followed:

https://learn.microsoft.com/en-us/office/dev/add-ins/outlook/pinnable-taskpane#implement-the-event-handler

I need to create a taskpane that will display emails as they are added as attendees.


Solution

  • To listen for when attendees are added in calendar, you can register for the RecipientsChanged event. This event triggers when the recipient list of the selected item or the appointment location is changed in Outlook. Support for this event was added in requirement set 1.7. Documentation about this event can be found here. Supported events include RecurrenceChanged, RecipientsChanged, and AppointmentTimeChanged.

    To add the event, you would need to call addHandlerAsync like:

    Office.context.mailbox.item.addHandlerAsync(Office.EventType.RecipientsChanged, handler, callback);
    

    where you can specify the handler and callback. Documentation for addHandlerAsync can be found here.