When querying email its HTML content is different from the RAW data
This is the crosspost of this question: https://techcommunity.microsoft.com/t5/exchange/graph-api-email-content-is-different-from-raw-data/m-p/3869250
I send an email with dashed item list (put dashes manually without clicking on any buttons):
- x
- x
- x
When I afterwards check its raw data in Graph API:
https://graph.microsoft.com/v1.0/users/[USER]/messages/[MID]?$select=$value
I receive a correct email body (after manually parsing and un-base64 eml):
<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word"
xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face {
font-family: Wingdings;
panose-1: 5 0 0 0 0 0 0 0 0 0;
}
@font-face {
font-family: "Cambria Math";
panose-1: 2 4 5 3 5 4 6 3 2 4;
}
@font-face {
font-family: Calibri;
panose-1: 2 15 5 2 2 2 4 3 2 4;
}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal {
margin: 0cm;
font-size: 11.0pt;
font-family: "Calibri", sans-serif;
mso-ligatures: standardcontextual;
}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph {
mso-style-priority: 34;
margin-top: 0cm;
margin-right: 0cm;
margin-bottom: 0cm;
margin-left: 36.0pt;
font-size: 11.0pt;
font-family: "Calibri", sans-serif;
mso-ligatures: standardcontextual;
}
span.EmailStyle17 {
mso-style-type: personal-compose;
font-family: "Calibri", sans-serif;
color: windowtext;
}
.MsoChpDefault {
mso-style-type: export-only;
font-family: "Calibri", sans-serif;
}
WordSection1 {
size: 612.0pt 792.0pt;
margin: 72.0pt 72.0pt 72.0pt 72.0pt;
}
div.WordSection1 {
page: WordSection1;
}
/* List Definitions */
@list l0 {
mso-list-id: 1561476882;
mso-list-type: hybrid;
mso-list-template-ids: -343380202 -1048276170 67698691 67698693 67698689 67698691 67698693 67698689 67698691 67698693;
}
@list l0:level1 {
mso-level-start-at: 0;
mso-level-number-format: bullet;
mso-level-text: -;
mso-level-tab-stop: none;
mso-level-number-position: left;
text-indent: -18.0pt;
font-family: "Calibri", sans-serif;
mso-fareast-font-family: Calibri;
}
@list l0:level2 {
mso-level-number-format: bullet;
mso-level-text: o;
mso-level-tab-stop: none;
mso-level-number-position: left;
text-indent: -18.0pt;
font-family: "Courier New";
}
@list l0:level3 {
mso-level-number-format: bullet;
mso-level-text: ;
mso-level-tab-stop: none;
mso-level-number-position: left;
text-indent: -18.0pt;
font-family: Wingdings;
}
@list l0:level4 {
mso-level-number-format: bullet;
mso-level-text: ;
mso-level-tab-stop: none;
mso-level-number-position: left;
text-indent: -18.0pt;
font-family: Symbol;
}
@list l0:level5 {
mso-level-number-format: bullet;
mso-level-text: o;
mso-level-tab-stop: none;
mso-level-number-position: left;
text-indent: -18.0pt;
font-family: "Courier New";
}
@list l0:level6 {
mso-level-number-format: bullet;
mso-level-text: ;
mso-level-tab-stop: none;
mso-level-number-position: left;
text-indent: -18.0pt;
font-family: Wingdings;
}
@list l0:level7 {
mso-level-number-format: bullet;
mso-level-text: ;
mso-level-tab-stop: none;
mso-level-number-position: left;
text-indent: -18.0pt;
font-family: Symbol;
}
@list l0:level8 {
mso-level-number-format: bullet;
mso-level-text: o;
mso-level-tab-stop: none;
mso-level-number-position: left;
text-indent: -18.0pt;
font-family: "Courier New";
}
@list l0:level9 {
mso-level-number-format: bullet;
mso-level-text: ;
mso-level-tab-stop: none;
mso-level-number-position: left;
text-indent: -18.0pt;
font-family: Wingdings;
}
ol {
margin-bottom: 0cm;
}
ul {
margin-bottom: 0cm;
}
--></style>
</head>
<body lang="en-IL" link="#0563C1" vlink="#954F72" style="word-wrap:break-word">
<div class="WordSection1">
<ul style="margin-top:0cm" type="disc">
<li class="MsoListParagraph" style="margin-left:0cm;mso-list:l0 level1 lfo1"><span lang="EN-US">X<o:p></o:p></span></li>
<li class="MsoListParagraph" style="margin-left:0cm;mso-list:l0 level1 lfo1"><span lang="EN-US">X<o:p></o:p></span></li>
<li class="MsoListParagraph" style="margin-left:0cm;mso-list:l0 level1 lfo1"><span lang="EN-US">X<o:p></o:p></span></li>
<li class="MsoListParagraph" style="margin-left:0cm;mso-list:l0 level1 lfo1"><span lang="EN-US">Xx<o:p></o:p></span></li>
<li class="MsoListParagraph" style="margin-left:0cm;mso-list:l0 level1 lfo1"><span lang="EN-US">X<o:p></o:p></span></li>
<li class="MsoListParagraph" style="margin-left:0cm;mso-list:l0 level1 lfo1"><span lang="EN-US">X<o:p></o:p></span></li>
</ul>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
</div>
</body>
</html>
But when I request an email html body alone with:
https://graph.microsoft.com/v1.0/users/[USER]/messages/[MID]?$select=body
I receive it different:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style>
<!--
@font-face {
font-family: Wingdings
}
@font-face {
font-family: "Cambria Math"
}
@font-face {
font-family: Calibri
}
p.MsoNormal, li.MsoNormal, div.MsoNormal {
margin: 0cm;
font-size: 11.0pt;
font-family: "Calibri", sans-serif
}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph {
margin-top: 0cm;
margin-right: 0cm;
margin-bottom: 0cm;
margin-left: 36.0pt;
font-size: 11.0pt;
font-family: "Calibri", sans-serif
}
span.EmailStyle17 {
font-family: "Calibri", sans-serif;
color: windowtext
}
.MsoChpDefault {
font-family: "Calibri", sans-serif
}
WordSection1 {
margin: 72.0pt 72.0pt 72.0pt 72.0pt
}
div.WordSection1 {
}
ol {
margin-bottom: 0cm
}
ul {
margin-bottom: 0cm
}
-->
</style>
</head>
<body lang="en-IL" link="#0563C1" vlink="#954F72" style="word-wrap:break-word">
<div class="WordSection1">
<ul type="disc" style="margin-top:0cm">
<li class="MsoListParagraph" style="margin-left:0cm"><span lang="EN-US">X</span></li>
<li class="MsoListParagraph" style="margin-left:0cm"><span lang="EN-US">X</span></li>
<li class="MsoListParagraph" style="margin-left:0cm"><span lang="EN-US">X</span></li>
<li class="MsoListParagraph" style="margin-left:0cm"><span lang="EN-US">Xx</span></li>
<li class="MsoListParagraph" style="margin-left:0cm"><span lang="EN-US">X</span></li>
<li class="MsoListParagraph" style="margin-left:0cm"><span lang="EN-US">X</span></li>
</ul>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p></div>
</body>
</html>
That means the email HTML content is different from the email RAW content. There are missing "mso-list:l0 level1 lfo1" styles. Because of that, when we update an email (by the Graph API POST request) with some additional content the dashes lists are converted to the bullets lists.