问题
I'm trying to use Office.context.mailbox.item.body.getAsync
and Office.context.mailbox.item.body.setAsync
Javascript methods in my Outlook add-in to add some content to the mail body. It's working really well, except when the user has an image on its signature. The image disappears and only its alt attribute is shown. If I inspect the html, the <img>
element is there, but the src
attribute turns into (unknown)
instead of showing the original base64.
回答1:
I work days on this problem without any solution to image,and I think that right now no solution for local images inside the body after using getAsync and setAsync . The only images that could work for you it's images that sit on external server or outlook emoji .
You could read more Here , this question is on Microsoft developer forum , the conclusion from this question is:
Outlook Object Model and Outlook Add-ins are different. When you send email with image manually, it uses Outlook Object Model, and store the image in the email item, “src="cid:” indicate that image object in the email object. When you send with Office Add-ins, the email body only indicates the location of the image by “src”. There is no real image inserted into the mail item. To show the image both in sender and receiver, you will need to place the image in a public place that everyone could access.
You can maybe try to use Outlook rest API . You could use now Outlook rest API in easy way from your add in .Read more about it in this link. Then follow on this question and try to solve the image problem with Outlook rest API request to get all attachment before using 'setAsync' and then change the image source to the base 64 data of your image.
Good luck.
Edit : I write answer to fimiliar question here: outlook add-in image & files , maybe it's could help you to solve your problem .
来源:https://stackoverflow.com/questions/42459526/office-context-mailbox-item-body-setasync-removing-original-base64-from-signatur