Artem K
Artem K

Reputation: 169

setAsync and getAsync issues with returned HTML in Outlook 365 API

We are having an issue with window.Office.context.mailbox.item.body.setAsync modifying html that we send to it. Specifically the signature.

Original html passed in here:

window.Office.context.mailbox.item.body.setAsync(html, { coercionType: window.Office.CoercionType.Html }, (response) => {
    if (response.error) {
        console.error('setBody Error :', response.error);
        callback && callback(response.error);
    } else {
        callback && callback(null);
    }
});

contains an image in a signature with the src looking something like this: <img class="EmojiInsert" src="data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEASABIAAD/2w...

However after we pass it into setAsync and call window.Office.context.mailbox.item.body.getAsync('html', ...) immediately, what we receive back is: <img class="EmojiInsert" src="" in the signature.

This only applies to signature images, any other image attached to the email is returned correctly.

Is there something that we are not doing right?

Thank you

Upvotes: 1

Views: 282

Answers (1)

user7823505
user7823505

Reputation:

For security, we do not support attaching images directly through the SetAsync apis. In order to insert an image inline, you need to first add it as an attachment with the isInline property set to true, then insert your image tag with src='cid:myImage.jpg'. Check out the tutorial here for a quick example.

Upvotes: 1

Related Questions