Hi,
I'm trying to edit the html body of an email.
I want to replace some text within the body, do I need to convert the email body to text before this can be done?
Thanks
Hello @garethaw
You do not need to convert back. Both works !!!! You can edit as HTML or covert back to text edit and then convert to HTML again
Great, are you able to point me in the right direction. I've got the contents of the email. I want to replace some text "75-100%" with "91%" ?
Use replace() function.
I've tried using the replace expression but it says in the input is of type of object?
Please show your replace.
replace(body('Email'), '75%-100%', '91%')
What's your second block - "Get email (V2)" or "Get emails (V3)"?
v3
Click "Show raw output" in "Get emails (V3)".
You'll see something like this. Note that "body" contains array "value". Each element of this array represents a message.
"statusCode": 200,
"headers": {
"Pragma": "no-cache",
"Transfer-Encoding": "chunked",
...
"Expires": "-1",
"Content-Length": "33628"
},
"body": {
"value": [
{
"id": "AAMkAGQ4YTA4OWNiLTQzMDQtNDQ1YS05YWI1LWVkM2M0NTU2ZWIyYQBGAAAAAAAeFskUmM3QT6bXbUpoyma4BwAzka6HX-3hR5u7st8nEUz8AAAAAAEMAAAzka6HX-3hR5u7st8nEUz8AAMKTIVIAAA=",
...
Here's a link that shows how to create the email in Outlook and copy the code into PowerAutomate, without the need to code it all: https://davidlozzi.com/2018/11/01/sending-a-beautifully-formatted-email-from-microsoft-flow/#respond
The "value" is an empty array. It means there are no emails have been retrieved.
You should check if the value is empty before trying to replace.
The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.
Learn to digitize and optimize business processes and connect all your applications to share data in real time.
User | Count |
---|---|
64 | |
55 | |
29 | |
27 | |
25 |