c# - 删除 EWS EmailMessage 正文中的 HTML 部分

标签 c# html css exchangewebservices

我想在通过 ResponseMessage< 回复之前删除 EWS EmailMessage .Body.Text 值的一部分 HTML 内容C#

要移除的内容如下,包含可点击和不可点击的html按钮。

我看到我们不能声明我们自己的自定义标签,所以我无法通过定位自定义 html 标签来使用 string.replace

我可以知道我的任务是否有变通方法,例如将下面的内容放在占位符中等吗?

<table class="MsoNormalTable" border="0" cellspacing="0" cellpadding="0" width="100%" style="width:100.0%">
<tbody>
<tr>
<td style="padding:0in 0in 0in 0in">
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:&quot;Times New Roman&quot;,serif">&nbsp;<o:p></o:p></span></p>
</td>
<td width="30%" style="width:30.0%;background:#17202A;padding:4.5pt 4.5pt 4.5pt 4.5pt;display:inline-block">
<p class="MsoNormal" align="center" style="text-align:center"><b><span style="font-size:11.5pt;font-family:&quot;Helvetica&quot;,sans-serif;color:white">ACTION: ADD
<o:p></o:p></span></b></p>
</td>
<td style="padding:0in 0in 0in 0in">
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:&quot;Times New Roman&quot;,serif">&nbsp;<o:p></o:p></span></p>
</td>
<td width="30%" style="width:30.0%;background:#17202A;padding:4.5pt 4.5pt 4.5pt 4.5pt;display:inline-block">
<p class="MsoNormal" align="center" style="text-align:center"><b><span style="font-size:11.5pt;font-family:&quot;Helvetica&quot;,sans-serif;color:white">ACTION: MINUS
<o:p></o:p></span></b></p>
</td>
<td style="padding:0in 0in 0in 0in">
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:&quot;Times New Roman&quot;,serif">&nbsp;<o:p></o:p></span></p>
</td>
<td width="20%" style="width:20.0%;background:#3A69C2;padding:4.5pt 4.5pt 4.5pt 4.5pt;display:inline-block">
<p class="MsoNormal" align="center" style="text-align:center"><b><span style="font-size:11.5pt;font-family:&quot;Helvetica&quot;,sans-serif;color:white"><a href="mailto:test.com?subject=[MULTIPLY];body=ACTION:%20MULTIPLY"><span style="color:white;background:#3A69C2;text-decoration:none">MULTIPLY
</span></a><o:p></o:p></span></b></p>
</td>
<td style="padding:0in 0in 0in 0in">
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:&quot;Times New Roman&quot;,serif">&nbsp;<o:p></o:p></span></p>
</td>
<td width="20%" style="width:20.0%;background:#3A69C2;padding:4.5pt 4.5pt 4.5pt 4.5pt;display:inline-block">
<p class="MsoNormal" align="center" style="text-align:center"><b><span style="font-size:11.5pt;font-family:&quot;Helvetica&quot;,sans-serif;color:white"><a href="mailto:test.com?subject=[DIVIDE];body=ACTION:%20DIVIDE"><span style="color:white;background:#3A69C2;text-decoration:none">DIVIDE
</span></a><o:p></o:p></span></b></p>
</td>
<td style="padding:0in 0in 0in 0in">
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:&quot;Times New Roman&quot;,serif">&nbsp;<o:p></o:p></span></p>
</td>
</tr>
</tbody>
</table>

最佳答案

可以使用html标签的Id属性吗https://www.w3schools.com/tags/att_id.asp识别要删除的标签?

关于c# - 删除 EWS EmailMessage 正文中的 HTML 部分,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58636491/

相关文章:

javascript - 从另一个站点获取 HTML 内容

css - FlexBox 对齐属性的问题

javascript - 如何在jquery代码中集成 "if"

c# - 为什么 Java on Server 和 C# on Client 是流行的选择?

c# - Desalinizing 初始化列表

javascript - 解析嵌套 json 的语法

html - 使用嵌套容器创建响应式 CSS 布局

c# - 正确的MVVM方法

C#设置默认参数,字符串数组(string[])

html - 溢出隐藏隐藏下拉菜单,但 overflow hidden 隐藏导航背景