ersinesen
Dec 12, 2023Copper Contributor
Status:
New
[Outlook ItemSend Add-in] Modify the email content
In ItemSend Event handler, I want to change the email content. Send back the modified content to the user for confirmation.
function validateBody(event) {
mailboxItem.body.getAsync(
"html",
{ asyncContext: event },
checkBodyOnlyOnSendCallBack,
);
}
function checkBodyOnlyOnSendCallBack(asyncResult) {
...
if (checkBody) {
// Modify content in asyncResult.value, which is immutable here
// Inplace modification or open a new email form
// Block send if blocked words were found
asyncResult.asyncContext.completed({ allowEvent: false });
} else {
// Allow send.
asyncResult.asyncContext.completed({ allowEvent: true });
}
}
1 Comment
Sort By
- hareluya86Copper Contributor
I'm trying to tackle the same use case as well. While I'm stuck with another issue in the event handler, just wondering if you had tried:
Office.context.mailbox.item.body.setAsync
within your if(checkBody) code?