I'm working on an Office JS add-in that requires detecting when creating a new appointment/meeting in Office 365 Outlook to call some function. I ran into the following on Microsoft's site:
I tried using:
Office.context.mailbox.addHandlerAsync(Office.RecipientsChangedFields, function(){
...
}
But that doesn't seem to be correct, anyone have any idea?
You need to set up the event handler on the item
object, not mailbox:
Office.context.mailbox.item.addHandlerAsync(
Office.EventType.RecipientsChanged,
() => {
console.log("Recipients changed");
},
(asyncResult) => {
if (asyncResult.status === Office.AsyncResultStatus.Failed) {
console.error(asyncResult.error);
reject();
} else {
resolve();
}
}
);