How to remove html characters when copying Email content to SharePoint List

Iron Contributor

I have a flow which copies Email content (Body) into a SharePoint list field (multiple lines text).

The content gets copied with html tags. 

How can i remove the html tags?

 

The content below was a simple "Test 6" in the email body which then was copied with all  the additional markup into the SharePoint list.

 

------ Example ---------- 

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style>
<!--
@font-face
    {font-family:"Cambria Math"}
@font-face
    {font-family:Calibri}
p.MsoNormal, li.MsoNormal, div.MsoNormal
    {margin:0in;
    margin-bottom:.0001pt;
    font-size:11.0pt;
    font-family:"Calibri",sans-serif}
a:link, span.MsoHyperlink
    {color:#0563C1;
    text-decoration:underline}
a:visited, span.MsoHyperlinkFollowed
    {color:#954F72;
    text-decoration:underline}
span.EmailStyle17
    {font-family:"Calibri",sans-serif;
    color:windowtext}
.MsoChpDefault
    {font-family:"Calibri",sans-serif}
@page WordSection1
    {margin:1.0in 1.0in 1.0in 1.0in}
div.WordSection1
    {}
-->
</style>
</head>
<body lang="EN-US" link="#0563C1" vlink="#954F72">
<div class="WordSection1">
<p class="MsoNormal">Test 6</p>
</div>
</body>
</html>

----- Example ----

 

 

 

@Jon Levesque@Mikael Svenson

11 Replies
Hello,
Does setting the multiple lines of text field to "plain text" in SharePoint help?

I tried that but it doesn't help.

One approach is to create a custom flow action which parses the HTML for you in order to grab the text. Or store the full e-mail as a .msg file in a doc lib - as SPO now has online viewer for msg files.

Thanks @Mikael Svenson.  I realized that using Enhanced Rich Text as the field type works.

image.png

Hello, sorry I'm just jumping in here because of your mention of the viewer for .msg files. How do we enable/access this?

Hi,
the fact that I don't know how to save an email from a Flow to a lib as msg is one thing.. but if you put a .msg file in a modern library and click it, it will render in the browser.

Hi Mikael,

 

Thanks for your reply. So I've tried exactly this (in FF and IE) but receive the message "Hmmmm...looks like this file doesn't have a preview we can show you."

 

Just wondering if there is a plugin that is required or setting that is not enabled that you might be aware of?

 

Thanks

Gav

You can ignore me! Tried it with a different email and it works beautifully...thanks!

I saved an e-mail from Outlook as msg in a lib, clicked it and it uses Office Online Server to render it - just like Word etc. You could test with a simple .txt file. Works fine in the tenants I've tried (all first release, so could be a thing) and in all browsers.

 

If the file is not supported it downloads the file instead.

I am trying to do a similar thing with the body of an email, but I'm not sure if the same settings for email, not Sharepoint. I don't see a Enhanced Rich Text option, but I'm new to flow, so not sure if I just don't know where to look. See screenshot for the problematic body text. 

 

Body: <html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta content="text/html; charset=us-ascii">
</head>
<body>
 
 
text
 
</body>
</html>