cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
MB-HealthSci
Regular Visitor

Re: Using Power Automate to send an Adaptive Card-Based Email through Outlook

Greetings @VJR,

 

I wanted to provide a late update.  I was successful in creating a cloud based flow using the "Compose" action into which I pasted the adaptive card template.  Now, I have an adaptive card-based email with a user-specific attachment which seems to be working (which was the goal).  Thanks again for the help!

 

May I ask a related question?  When exploring the formatting of the adaptive card, initially I used the FactSet container to communicate the needed information (which renders well).  Because the FactSet container is somewhat limited in formatting (I do not believe one can adjust the width of the FactSet "title", "value" pairs), I experimented with the "Table" container.  Interestingly, even when using the adaptive card designer (https://adaptivecards.io/designer/), and copying the example card template code (within the Schema Explorer page) for tables (https://adaptivecards.io/explorer/Table.html) into a "New Card" (blank card), the message that is generated reads "[Parse] Unknown element type "Table".  Fallback will be used if present".  I find it interesting that the Schema Explorer code, when directly copied and pasted, does not even render within the adaptive card designer.  As expected, when I tried the Table container within my cloud flow it failed to render.  I believe the reason is due to the host app schema version.  It appears Table containers are only recognized by version 1.5 and yet the Bot Framework Web Chat and Microsoft Teams apps (which have the highest Schema Versions in the "Select host app" list) are only at 1.4.  May I ask if this is an issue you have been exposed to, and if this implies  Tables simply are not capable of being rendered until the host app versions increase (I hope my question makes sense, and my apologies if it doesn't)?

 

The example code from the Table Schema Explorer is:

 

 

{
    "type": "AdaptiveCard",
    "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
    "version": "1.5",
    "body": [
        {
            "type": "TextBlock",
            "text": "Table with gridlines",
            "wrap": true,
            "style": "heading"
        },
        {
            "type": "Table",
            "columns": [
                {
                    "width": 1
                },
                {
                    "width": 1
                }
            ],
            "rows": [
                {
                    "type": "TableRow",
                    "cells": [
                        {
                            "type": "TableCell",
                            "items": [
                                {
                                    "type": "TextBlock",
                                    "text": "showGridLines value",
                                    "wrap": true
                                }
                            ],
                            "style": "accent"
                        },
                        {
                            "type": "TableCell",
                            "items": [
                                {
                                    "type": "TextBlock",
                                    "text": "Behavior",
                                    "wrap": true
                                }
                            ],
                            "style": "accent"
                        }
                    ]
                },
                {
                    "type": "TableRow",
                    "cells": [
                        {
                            "type": "TableCell",
                            "items": [
                                {
                                    "type": "TextBlock",
                                    "text": "true",
                                    "wrap": true
                                }
                            ],
                            "style": "accent"
                        },
                        {
                            "type": "TableCell",
                            "items": [
                                {
                                    "type": "TextBlock",
                                    "text": "Cells are separated by 1px width gridlines",
                                    "wrap": true
                                }
                            ],
                            "style": "accent"
                        }
                    ]
                },
                {
                    "type": "TableRow",
                    "cells": [
                        {
                            "type": "TableCell",
                            "items": [
                                {
                                    "type": "TextBlock",
                                    "text": "false",
                                    "wrap": true
                                }
                            ],
                            "style": "accent"
                        },
                        {
                            "type": "TableCell",
                            "items": [
                                {
                                    "type": "TextBlock",
                                    "text": "Cells are separated by the cell spacing value configued in hostconfig",
                                    "wrap": true
                                }
                            ],
                            "style": "accent"
                        }
                    ]
                }
            ]
        },
        {
            "type": "TextBlock",
            "text": "Table without gridlines",
            "wrap": true,
            "style": "heading"
        },
        {
            "type": "Table",
            "columns": [
                {
                    "width": 1
                },
                {
                    "width": 1
                }
            ],
            "rows": [
                {
                    "type": "TableRow",
                    "cells": [
                        {
                            "type": "TableCell",
                            "items": [
                                {
                                    "type": "TextBlock",
                                    "text": "showGridLines value",
                                    "wrap": true
                                }
                            ],
                            "style": "accent"
                        },
                        {
                            "type": "TableCell",
                            "items": [
                                {
                                    "type": "TextBlock",
                                    "text": "Behavior",
                                    "wrap": true
                                }
                            ],
                            "style": "accent"
                        }
                    ]
                },
                {
                    "type": "TableRow",
                    "cells": [
                        {
                            "type": "TableCell",
                            "items": [
                                {
                                    "type": "TextBlock",
                                    "text": "true",
                                    "wrap": true
                                }
                            ],
                            "style": "accent"
                        },
                        {
                            "type": "TableCell",
                            "items": [
                                {
                                    "type": "TextBlock",
                                    "text": "Cells are separated by 1px width gridlines",
                                    "wrap": true
                                }
                            ],
                            "style": "accent"
                        }
                    ]
                },
                {
                    "type": "TableRow",
                    "cells": [
                        {
                            "type": "TableCell",
                            "items": [
                                {
                                    "type": "TextBlock",
                                    "text": "false",
                                    "wrap": true
                                }
                            ],
                            "style": "accent"
                        },
                        {
                            "type": "TableCell",
                            "items": [
                                {
                                    "type": "TextBlock",
                                    "text": "Cells are separated by the cell spacing value configued in hostconfig",
                                    "wrap": true
                                }
                            ],
                            "style": "accent"
                        }
                    ]
                }
            ],
            "showGridLines": false
        }
    ]
}

 

 

Thanks again, and my apologies for being quite slow.

 

-matt

 

10 REPLIES 10
MB-HealthSci
Regular Visitor

I am using Power Automate (PA) Desktop to send emails to a variety of staff based on data contained in an Excel file.  To achieve the desired email formatting, I am attempting to use an adaptive card template.  The data for the template is being filled from the previously mentioned excel file.  I am using the 'Send email message through Outlook' action to compose and send the email.  In the "Body" field, I have copied and pasted the JSON template with the defined excel data variables (inside %%):

 

 

 

<script type="application/adaptivecard+json">
{
  "type": "AdaptiveCard",
  "body": [
    {
      "type": "TextBlock",
      "size": "Medium",
      "weight": "Bolder",
      "text": "Weekly At-Risk Students Report"
    },
    {
      "type": "ColumnSet",
      "columns": [
        {
          "type": "Column",
          "items": [
            {
              "type": "Image",
              "style": "Person",
              "url": "${creator.profileImage}",
              "size": "Small"
            }
          ],
          "width": "auto"
        },
        {
          "type": "Column",
          "items": [
            {
              "type": "TextBlock",
              "weight": "Bolder",
              "text": "%name%",
              "wrap": true
            },
            {
              "type": "TextBlock",
              "spacing": "None",
              "text": "For Week Of: TEST",
              "isSubtle": true,
              "wrap": true
            }
          ],
          "width": "stretch"
        }
      ]
    },
    {
      "type": "TextBlock",
      "text": "Please see the at-risk student information below:",
      "wrap": true
    },
    {
      "type": "FactSet",
      "facts": [
        {
          "$data": "${properties}",
          "title": "Instructor:",
          "value": "%name%,"
        }
      ]
    },
    {
      "type": "FactSet",
      "facts": [
        {
          "$data": "${properties}",
          "title": "Email:",
          "value": "%email%"
        }
      ]
    },
    {
      "type": "FactSet",
      "facts": [
        {
          "$data": "${properties}",
          "title": "Attachment Location:",
          "value": "%filepath%"
        }
      ]
    },
    {
      "type": "FactSet",
      "facts": [
        {
          "$data": "${properties}",
          "title": "Number of Students:",
          "value": "%nstudents%"
        }
      ]
    },
    {
      "type": "FactSet",
      "facts": [
        {
          "$data": "${properties}",
          "title": "At-Risk Students:",
          "value": "%narn%"
        }
      ]
    },
    {
      "type": "FactSet",
      "facts": [
        {
          "$data": "${properties}",
          "title": "Notes Submitted:",
          "value": "%narn%"
        }
      ]
    },
    {
      "type": "FactSet",
      "facts": [
        {
          "$data": "${properties}",
          "title": "Notes Needed:",
          "value": "%narnn%"
        }
      ]
    },
    {
      "type": "FactSet",
      "facts": [
        {
          "$data": "${properties}",
          "title": "Unsubmitted Assignments:",
          "value": "%nua%"
        }
      ]
    },
    {
      "type": "FactSet",
      "facts": [
        {
          "$data": "${properties}",
          "title": "Late Graded Assignments:",
          "value": "%nlgar%"
        }
      ]
    },
    {
      "type": "FactSet",
      "facts": [
        {
          "$data": "${properties}",
          "title": "Days Since Last Canvas Access:",
          "value": "%ndslcacc%"
        }
      ]
    },
    {
      "type": "FactSet",
      "facts": [
        {
          "$data": "${properties}",
          "title": "Days Since Last Canvas Activity:",
          "value": "%ndslcactive%"
        }
      ]
    }
  ],
  "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
  "version": "1.5"
}
</script>

 

 

 

 Even with the "Body is HTML" slider (within the 'Send email message through Outlook' action) slid to the TRUE position, upon running the flow I find the JSON object is not rendered (the email is blank).  The documentation led me to believe that following the line, "<script type="application/adaptivecard+json">," the following JSON should, in fact, be rendered. Since I am quite new to the power apps and to adaptive cards, my hope is that the error I am making is common and therefore easy to find.  For those of you with experience sending adaptive cards using PA, may I ask if you can spot the syntactic or logical error?

 

Thank you very much for any help in the right direction, and if you need any additional information please feel free to let me know.

 

-matt

Maybe you need <html> tags surrounding everything? 🤷‍♂️

Thanks for the suggestion @Henrik_M !  

 

I added in the opening and closing <html> tags (copied below for completeness), however unfortunately Outlook is not rendering the JSON still.

 

 

<html>
<script type="application/adaptivecard+json">
{
  "type": "AdaptiveCard",
  "body": [
    {
      "type": "TextBlock",
      "size": "Medium",
      "weight": "Bolder",
      "text": "Weekly At-Risk Students Report"
    },
    {
      "type": "ColumnSet",
      "columns": [
        {
          "type": "Column",
          "items": [
            {
              "type": "Image",
              "style": "Person",
              "url": "${creator.profileImage}",
              "size": "Small"
            }
          ],
          "width": "auto"
        },
        {
          "type": "Column",
          "items": [
            {
              "type": "TextBlock",
              "weight": "Bolder",
              "text": "%name%",
              "wrap": true
            },
            {
              "type": "TextBlock",
              "spacing": "None",
              "text": "For Week Of: TEST",
              "isSubtle": true,
              "wrap": true
            }
          ],
          "width": "stretch"
        }
      ]
    },
    {
      "type": "TextBlock",
      "text": "Please see the at-risk student information below:",
      "wrap": true
    },
    {
      "type": "FactSet",
      "facts": [
        {
          "$data": "${properties}",
          "title": "Instructor:",
          "value": "%name%,"
        }
      ]
    },
    {
      "type": "FactSet",
      "facts": [
        {
          "$data": "${properties}",
          "title": "Email:",
          "value": "%email%"
        }
      ]
    },
    {
      "type": "FactSet",
      "facts": [
        {
          "$data": "${properties}",
          "title": "Attachment Location:",
          "value": "%filepath%"
        }
      ]
    },
    {
      "type": "FactSet",
      "facts": [
        {
          "$data": "${properties}",
          "title": "Number of Students:",
          "value": "%nstudents%"
        }
      ]
    },
    {
      "type": "FactSet",
      "facts": [
        {
          "$data": "${properties}",
          "title": "At-Risk Students:",
          "value": "%narn%"
        }
      ]
    },
    {
      "type": "FactSet",
      "facts": [
        {
          "$data": "${properties}",
          "title": "Notes Submitted:",
          "value": "%narn%"
        }
      ]
    },
    {
      "type": "FactSet",
      "facts": [
        {
          "$data": "${properties}",
          "title": "Notes Needed:",
          "value": "%narnn%"
        }
      ]
    },
    {
      "type": "FactSet",
      "facts": [
        {
          "$data": "${properties}",
          "title": "Unsubmitted Assignments:",
          "value": "%nua%"
        }
      ]
    },
    {
      "type": "FactSet",
      "facts": [
        {
          "$data": "${properties}",
          "title": "Late Graded Assignments:",
          "value": "%nlgar%"
        }
      ]
    },
    {
      "type": "FactSet",
      "facts": [
        {
          "$data": "${properties}",
          "title": "Days Since Last Canvas Access:",
          "value": "%ndslcacc%"
        }
      ]
    },
    {
      "type": "FactSet",
      "facts": [
        {
          "$data": "${properties}",
          "title": "Days Since Last Canvas Activity:",
          "value": "%ndslcactive%"
        }
      ]
    }
  ],
  "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
  "version": "1.5"
}
</script>
</html>

 

Still, I most certainly appreciate the suggestion!

-matt

Hi @MB-HealthSci 

 

I don't think json can be rendered when html is passed.

You might want to use a json to html converter to find the corresponding html and then modify as per requirement.

 

 

 

I tried converting the json you shared on both these links and was seeing some kind of output. 

PS: I had to remove the <script> tag because again it is html and not Json.

Thank you @VJR for taking the time to look into this!

 

Since I believe the goal to utilize the adaptive card, since after all adaptive cards can include actionable message elements, I am not sure if a pure html email can truly serve the same purpose (perhaps it can, however, my limited understanding is that the cross-platform formatting compatibility adaptive cards deliver, along with the actionable message potential is at least much more difficult to realize with html alone).  

 

Perhaps I am approaching the problem incorrectly.  The goal would be to use Power Automate (PA) to build recipient-specific adaptive cards (using the Excel data) and share that adaptive card through Outlook.  In the "big picture," may I ask if you are aware of how feasible it is to realize the idea this way?   Perhaps Outlook is the wrong PA action.  Perhaps there is another action that is better fit for the construction and dissemination of the adaptive card?  I should say that I have a colleague who was able to render JSON in Outlook using web-based PA.  In her case, she used the "Compose" item and pasted the JSON object into it (followed by utilizing the compose variable within the Outlook message construction).  In PA-Desktop, however, there is no "Compose" item/action.  I have tried pasting the JSON as a "Variable" item, however this attempt failed as well. 

 

Thank you again for taking the time to look into this!

 

-matt

Hi @MB-HealthSci 

 

I have gone through your entire message.

 

- That was my first instinct when I read the original post ie; to use Cloud flows because it has more integration options for adaptive cards. So is there any specific reason that you are using Desktop flows and not Cloud flows?

 

-  If you can print and share what was the input and output of the Compose action, we could think of seeing what are the similar possibilities in PAD.

Thanks again @VJR ,

 

My apologies for the delay.  I have not used cloud flows before, and I am finding it takes more time than expected to learn what feels like a nearly completely different app.  I am struggling to figure out how to reattach my user-specific attachments to my cloud flow, however once I have been able to fully reproduce what I have been able to do with my desktop client flow, I then will venture into the adaptive card territory.  

Again, and again, thank you for your help, and my apologies for the delay (the learning slope of the learning curve is rather steep, and apparently slippery).

 

-matt

VJR
Multi Super User
Multi Super User

Hi @MB-HealthSci , I have moved your post from Desktop flows to cloud flows. But I suggest you close this one and submit a new one here according to your latest situation so that you can get accurate help.

Have a look at the guide here. I believe you need to define a separate <head> and <body> in your HTML. The <script> tag goes into the <head> tag. 

 

I have successfully sent an adaptive card using A Power Automate cloud flow with the "Send Email (v2)" action. You should send the message to yourself to test. If you want to send to another user, you will need to go through additional steps, otherwise the card won't be rendered.

Hi there, I know it's been an age since you posted your question, but I am having a similar problem and I'd love to know how you solved yours. I am trying to put excel data into a table and send an adaptive card (teams not email) however I can't get the info from excel into the card. I have three columns and 12 rows including headers. Column A is text, the next three columns are times hh:mm:ss format.

Helpful resources

Announcements

Community will be READ ONLY July 16th, 5p PDT -July 22nd

Dear Community Members,   We'd like to let you know of an upcoming change to the community platform: starting July 16th, the platform will transition to a READ ONLY mode until July 22nd.   During this period, members will not be able to Kudo, Comment, or Reply to any posts.   On July 22nd, please be on the lookout for a message sent to the email address registered on your community profile. This email is crucial as it will contain your unique code and link to register for the new platform encompassing all of the communities.   What to Expect in the New Community: A more unified experience where all products, including Power Apps, Power Automate, Copilot Studio, and Power Pages, will be accessible from one community.Community Blogs that you can syndicate and link to for automatic updates. We appreciate your understanding and cooperation during this transition. Stay tuned for the exciting new features and a seamless community experience ahead!

Summer of Solutions | Week 4 Results | Winners will be posted on July 24th

We are excited to announce the Summer of Solutions Challenge!    This challenge is kicking off on Monday, June 17th and will run for (4) weeks.  The challenge is open to all Power Platform (Power Apps, Power Automate, Copilot Studio & Power Pages) community members. We invite you to participate in a quest to provide solutions to as many questions as you can. Answers can be provided in all the communities.    Entry Period: This Challenge will consist of four weekly Entry Periods as follows (each an “Entry Period”)   - 12:00 a.m. PT on June 17, 2024 – 11:59 p.m. PT on June 23, 2024 - 12:00 a.m. PT on June 24, 2024 – 11:59 p.m. PT on June 30, 2024 - 12:00 a.m. PT on July 1, 2024 – 11:59 p.m. PT on July 7, 2024 - 12:00 a.m. PT on July 8, 2024 – 11:59 p.m. PT on July 14, 2024   Entries will be eligible for the Entry Period in which they are received and will not carryover to subsequent weekly entry periods.  You must enter into each weekly Entry Period separately.   How to Enter: We invite you to participate in a quest to provide "Accepted Solutions" to as many questions as you can. Answers can be provided in all the communities. Users must provide a solution which can be an “Accepted Solution” in the Forums in all of the communities and there are no limits to the number of “Accepted Solutions” that a member can provide for entries in this challenge, but each entry must be substantially unique and different.    Winner Selection and Prizes: At the end of each week, we will list the top ten (10) Community users which will consist of: 5 Community Members & 5 Super Users and they will advance to the final drawing. We will post each week in the News & Announcements the top 10 Solution providers.  At the end of the challenge, we will add all of the top 10 weekly names and enter them into a random drawing.  Then we will randomly select ten (10) winners (5 Community Members & 5 Super Users) from among all eligible entrants received across all weekly Entry Periods to receive the prize listed below. If a winner declines, we will draw again at random for the next winner.  A user will only be able to win once overall. If they are drawn multiple times, another user will be drawn at random.  Individuals will be contacted before the announcement with the opportunity to claim or deny the prize.  Once all of the winners have been notified, we will post in the News & Announcements of each community with the list of winners.   Each winner will receive one (1) Pass to the Power Platform Conference in Las Vegas, Sep. 18-20, 2024 ($1800 value). NOTE: Prize is for conference attendance only and any other costs such as airfare, lodging, transportation, and food are the sole responsibility of the winner. Tickets are not transferable to any other party or to next year’s event.   ** PLEASE SEE THE ATTACHED RULES for this CHALLENGE**   Week 1 Results: Congratulations to the Week 1 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge.   Community MembersNumber SolutionsSuper UsersNumber Solutions Deenuji 9 @NathanAlvares24  17 @Anil_g  7 @ManishSolanki  13 @eetuRobo  5 @David_MA  10 @VishnuReddy1997  5 @SpongYe  9JhonatanOB19932 (tie) @Nived_Nambiar  8 @maltie  2 (tie)   @PA-Noob  2 (tie)   @LukeMcG  2 (tie)   @tgut03  2 (tie)       Week 2 Results: Congratulations to the Week 2 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Week 2: Community MembersSolutionsSuper UsersSolutionsPower Automate  @Deenuji  12@ManishSolanki 19 @Anil_g  10 @NathanAlvares24  17 @VishnuReddy1997  6 @Expiscornovus  10 @Tjan  5 @Nived_Nambiar  10 @eetuRobo  3 @SudeepGhatakNZ 8     Week 3 Results: Congratulations to the Week 3 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Week 3:Community MembersSolutionsSuper UsersSolutionsPower Automate Deenuji32ManishSolanki55VishnuReddy199724NathanAlvares2444Anil_g22SudeepGhatakNZ40eetuRobo18Nived_Nambiar28Tjan8David_MA22   Week 4 Results: Congratulations to the Week 4 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Week 4:Community MembersSolutionsSuper UsersSolutionsPower Automate Deenuji11FLMike31Sayan11ManishSolanki16VishnuReddy199710creativeopinion14Akshansh-Sharma3SudeepGhatakNZ7claudiovc2CFernandes5 misc2Nived_Nambiar5 Usernametwice232rzaneti5 eetuRobo2   Anil_g2   SharonS2  

Check Out | 2024 Release Wave 2 Plans for Microsoft Dynamics 365 and Microsoft Power Platform

On July 16, 2024, we published the 2024 release wave 2 plans for Microsoft Dynamics 365 and Microsoft Power Platform. These plans are a compilation of the new capabilities planned to be released between October 2024 to March 2025. This release introduces a wealth of new features designed to enhance customer understanding and improve overall user experience, showcasing our dedication to driving digital transformation for our customers and partners.    The upcoming wave is centered around utilizing advanced AI and Microsoft Copilot technologies to enhance user productivity and streamline operations across diverse business applications. These enhancements include intelligent automation, AI-powered insights, and immersive user experiences that are designed to break down barriers between data, insights, and individuals. Watch a summary of the release highlights.    Discover the latest features that empower organizations to operate more efficiently and adaptively. From AI-driven sales insights and customer service enhancements to predictive analytics in supply chain management and autonomous financial processes, the new capabilities enable businesses to proactively address challenges and capitalize on opportunities.    

Updates to Transitions in the Power Platform Communities

We're embarking on a journey to enhance your experience by transitioning to a new community platform. Our team has been diligently working to create a fresh community site, leveraging the very Dynamics 365 and Power Platform tools our community advocates for.  We started this journey with transitioning Copilot Studio forums and blogs in June. The move marks the beginning of a new chapter, and we're eager for you to be a part of it. The rest of the Power Platform product sites will be moving over this summer.   Stay tuned for more updates as we get closer to the launch. We can't wait to welcome you to our new community space, designed with you in mind. Let's connect, learn, and grow together.   Here's to new beginnings and endless possibilities!   If you have any questions, observations or concerns throughout this process please go to https://aka.ms/PPCommSupport.   To stay up to date on the latest details of this migration and other important Community updates subscribe to our News and Announcements forums: Copilot Studio, Power Apps, Power Automate, Power Pages

Users online (513)