Daily findings

Vadym Barylo
DoneDOneSoft
Published in
1 min readAug 8, 2023

I was surprised that Office.js API (that is used to build Outlook extensions) has different behaviors in desktop and web versions when requesting email content.

When reading email as a text — web outlook trims all new line separators while desktop version preservers all. So, in desktop version requested email content looks almost same as user sees it on the screen opposite to web version — when all line separators are cleared.

To be precise — this statement will return different results regards the type of application your plugin is run in:

Text email

If it is important to preserve all whitespaces from original email — CoercionType.Text is not suitable here to have same support for both web and desktop outlook versions.

The solution is to convert original HTML into text by ourselves (using open-source libraries available)

Possible solution:

So, we will have same output for both web and desktop applications because our conversion is deterministic and uses same input.

--

--