jfolpf's avatar
jfolpf
Brass Contributor
Mar 03, 2022
Status:
New

Handler to detect Save event on Office Addin API

I would like to send some data to a server, said data fetched from the Outlook event, and I would like to have the latest updated data on the server.

 

In https://docs.microsoft.com/en-us/javascript/api/outlook/office.appointmentcompose?view=outlook-js-preview interface from Microsoft Office Addin JS API, there is no handler to detect when the user clicks the Save button or when presses CTRL+S, in an Outlook Event.

 

 

 

 

 

 

 

I found https://docs.microsoft.com/en-us/javascript/api/office/office.addincommands.event?view=common-js-preview, but this is only applicable to buttons inside the Add-in

// In this example, consider a button defined in an add-in manifest as follows:
//<Control xsi:type="Button" id="eventTestButton">
//    <Label resid="eventButtonLabel" />
//    <Tooltip resid="eventButtonTooltip" />
//    <Supertip>
//        <Title resid="eventSuperTipTitle" />
//        <Description resid="eventSuperTipDescription" />
//    </Supertip>
//    <Icon>
//        <bt:Image size="16" resid="blue-icon-16" />
//        <bt:Image size="32" resid="blue-icon-32" />
//        <bt:Image size="80" resid="blue-icon-80" />
//    </Icon>
//    <Action xsi:type="ExecuteFunction">
//        <FunctionName>testEventObject</FunctionName>
//    </Action>
//</Control>

// The button has an id attribute set to eventTestButton, and will invoke
// the testEventObject function defined in the add-in.
// That function looks like this:
function testEventObject(event) {
    // The event object implements the Event interface.

    // This value will be "eventTestButton".
    var buttonId = event.source.id;

    // Signal to the host app that processing is complete.
    event.completed();
}

I also found this https://docs.microsoft.com/en-us/office/dev/add-ins/reference/objectmodel/preview-requirement-set/office.context.mailbox.item#events of events, but they don't include save event.

1 Comment

  • Jim_den_Otter's avatar
    Jim_den_Otter
    Copper Contributor

    The ability to detect Save processing is critical in the Word API as well. In our case, we make service calls to a back end service on various events, and Save is definitely one we need to be able to hook.