Forum Discussion
Azure logic app - sent a visalized graph via email
Did you ever get this figured out? We are having the same issue. I saw the comment from Jysk0, who said to remove base64tostring but do not see where to do that. Any help would be appreciated.
- anish833Jan 11, 2024Copper Contributor
From the logic app code view you can edit the query part to include img tag with the output of the KQL query. The MIME type I used was jpeg and it worked for me
- sentineladminJan 11, 2024Copper Contributor
Thank you for the reply. Can you include your query and possibly explain that a bit more. We did get the email attachment working but not in the body.
- anish833Jan 16, 2024Copper Contributor
sentineladmin
In the logic app code view you can go to the "Send_an_email_(V2)" body where the pie chart (Add attachment content for any graph you want) in the query will be visible. From there you have to remove the base64 conversion, and add the img tag as below, the MIME type will be jpeg as shown, the kql displays charts in jpeg
Previous Query -@{base64ToString(body('Run_query_and_visualize_results')?['attachmentContent'])}
Modified Query -<img src=\"data:image/jpeg;base64, @{body('Run_query_and_visualize_results')?['attachmentContent']}\" alt=\"Pie Chart\" width=\"80%\" height=\"140%\">
Change the : to actual colon
You can adjust height and width as you see fit.
Note: You might get some random base64 string, for this just make sure you have checked the logic app code view for any syntax error and every time you will make change to the email content , it will mess up the img section, you have to manually change the query back to as shown in modified query.
Hope this helps