How can I insert an embedded image in Outlook with office-js

Viewed 1060

It is possible to embed a image in outlook email ? With this code outlook will insert a broken image mailBoxItem.body.setSelectedDataAsync

var linkToImage = '<img src=\"data:image/'+getTemplateExtension(template.templateType).replace('.','')+";base64," + sasLink + '\"/>';

                         //Add an image as a link
                        if (mailBoxItem.body.setSelectedDataAsync) {
                            mailBoxItem.body.setSelectedDataAsync(linkToImage, {
                                        asyncContext: null,
                                        coercionType: Office.CoercionType.Html
                                    },
                                    function(asyncResult) {
                                        if (asyncResult.status == "failed") {
                                            showMessage("Action failed with error: " + asyncResult.error.message);
                                        } else {
                                            showMessage("You successfully wrote in the email body. Click Next to learn more.");
                                        }
                                    }
                                )
                        }
1 Answers
Related