Outlook Addin API body.getAsync missing some styles on mac

200 Views Asked by At

Office.context.mailbox.item.body.getAsync() on mac misses certain styles, such as bullet points.

Details:

  • CoercionType.Html is used.
  • Only occurs on Outlook for Mac client, not on OWA.
  • Outlook for Mac Version 16.13 on macOS High Sierra 10.13.2.
  • To reproduce, insert bullets into the message body using the client UI:

• Testing bullets

  • Call getAsync with coercion type HTML and expect the following:

<p class=MsoListParagraph style='text-indent:0in'>Testing bullets</p>

  • Call setAsync with the above HTML and expect the bullet to disappear

Notes: I understand the documentation indicates:

Body.getAsync and Body.setAsync methods are not idempotent.

But the bullet is inserted from the Outlook UI itself and I expect the API to fully support it.

1

There are 1 best solutions below

3
On

You should be inserting as HTML unordered list elements, not a styled paragraph:

Word.run(function(context) {
  var body = context.document.body;
  body.insertHtml("<ul><li>Testing Bullet 1</li><li>Testing Bullet 2</li></ul>", Word.InsertLocation.start);
  return context.sync();
});