-------------------------------------------------------------------------------------------------------------------------------------------------------
This is an update regarding @Mikael Andersen's answer.
My Power Automate flow references Mikael's solution, which works very well for smaller images. However, for larger images—in my case, a 270kb image—when Azure DevOps creates the work item, the src attribute of the image (the base64 part) is completely missing in the HTML. Instead, a <div class="elementToProof"> appears in its place. This results in the image in the work item appearing as a white box with black borders.
</div><div class=elementToProof style=\"margin-top:1em;margin-bottom:1em;font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0);\"><img id=image_0 width=971 height=416 data-outlook-trace=\"F:1|T:1\" style=\"width:971px;height:416px;max-width:1219px;\"> </div><div class=elementToProof style=\"font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif;font-size:10pt;color:rgb(0,0,0);\">
You can refer to this issue here:
https://developercommunity.visualstudio.com/t/graphics-appear-to-be-inserted-in-repro-steps-or-d/448509?viewtype=solutions
My current workaround is to first upload the images (email attachments with isInline == true) in the email body as files to Azure DevOps, and then replace the cid content ID with the URL of the uploaded file. With this approach, the images are now displayed correctly.
replace(
variables('emailBody'),
concat('cid:', outputs('Get_Attachment_(V2)')?['body/contentId']),
outputs('Send_an_HTTP_request_to_Azure_DevOps')['body/url']
)
For guidance on how to upload images to Azure DevOps, you can refer to this blog post:
https://techcommunity.microsoft.com/blog/integrationsonazureblog/attaching-a-file-to-a-devops-work-item/3747394