javascriptoutlookoutlook-web-addins

OnAppointmentSave event in Microsoft outlook add-in


I'm developing an add-in for Microsoft Outlook using React and their JS SDK. The idea of the add-in is to provide some additional information about the appointment like what room to use, etc. For this, when a user starts creating an appointment in Outlook, they open our add-in, select properties they need, and when they click on the save appointment button in Outlook I need to catch this event in my add-in and send this data to our backend to create an appointment in our system as well. I stuck on the last step. From the Microsoft documentation, they have two ways to achieve this - the OnSend feature and Smart alerts (which is just a newer version of the OnSend feature). So I implemented Smart Alerts. Here is a list of events supported by smart alerts. The OnAppointmentSend event looks like exactly what I needed, but there I faced one problem - this event only fired when there are attendees added to the appointment. If there is at least one attendee, the Save button in Outlook turns to the Send button, and the OnAppointmentSend event fires correctly, but when there are no attendees at all the Save button is displayed and the OnAppointmentSend is not fired and so far I see there are no events like OnAppointmentSave or so.

Does anyone have solved such an issue?

To receive the OnAppointmentSend event I used the code from their docs. To map the event with the handler in manifest:

<ExtensionPoint xsi:type="LaunchEvent">
    <LaunchEvents>
        <LaunchEvent Type="OnAppointmentSend" FunctionName="OnAppointmentSendHandler" SendMode="PromptUser" />
    </LaunchEvents>
    <SourceLocation resid="WebViewRuntime.Url"/>
</ExtensionPoint>

And similar mapping on the Office SDK side:

Office.actions.associate("OnAppointmentSendHandler", (e) => console.log('OnAppointmentSend event', e);

This code works well, so the only problem is how to get an event for saving an appointment when there are no attendees.


Solution

  • As you say, there is no "OnApointmentSave" event, and therefore you cannot capture "Save" actions.

    Our approach in this case was to automatically add an attendee to all meetings on creation (in our case we added the requestor also as an attendee), which automatically converts all "save" actions to "send" actions.

    This does not seem to have other side effects. What is more, in Outlook desktop client, Outlook is automatically adding the requestor as an attendee.