I'm testing out the Outlook add-in Smart Alert event that trigger when a user click send email using this tutorial: Automatically check for an attachment before a message is sent
So with the SoftBlock mode, we can customize the Don't Send button. Is there a way we can customize the Send Anyway button for PromptUser mode?
Here's what I got so far:
/**
* Office Initializes here
* @param {Office.InitializationReason} reason
*/
Office.initialize = function (reason) {
console.log('Addin Loading in Send Message Menu');
};
function onMessageSendHandler(event) {
Office.context.mailbox.item.body.getAsync(
"text",
{ asyncContext: event },
getBodyCallback
);
}
function getBodyCallback(asyncResult){
const event = asyncResult.asyncContext;
event.completed({
allowEvent: false,
errorMessage: "Looks like you're missing a keyword, consider adding it",
cancelLabel: "Okay",
commandId: "MessageComposeSelectButton"
});
}
// IMPORTANT: To ensure your add-in is supported in the Outlook client on Windows, remember to map the event handler name specified in the manifest to its JavaScript counterpart.
if (Office.context.platform === Office.PlatformType.PC || Office.context.platform == null) {
Office.actions.associate("onMessageSendHandler", onMessageSendHandler);
}
I tried to create another event.completed and set allowEvent to true but that just said the Add-in finish processing my email