web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Embedding picture in a...
Power Automate
Unanswered

Embedding picture in a DevOps Work Item when a New Email Arrives

(0) ShareShare
ReportReport
Posted on by

Hello everyone,

 

First of all thank you guys for every bit of help I've indirectly got here while looking up how to build flows. I've only just started and I've found a lot of answers in here.

 

I've been able to make a pretty simple flow: When a new email arrives, I create a work item. I've been able to join the attachments too and to link it to its parent/child too. 

 

However, what I'm struggling to do is to embed the pictures in the attachments in the "Description" field in DevOps. I'm not sure this is the right place to post this, but since I'm struggling building my flow, I thought it might be.

 

I've joined pictures so you can see what I'm talking about.

 

https://imgur.com/pe6euHj

https://imgur.com/dZ6A79C

 

Have you guys any idea how I could do that? Do I have to go through a middle-man and upload the pictures on a drive or can it be done directly?

 

Thanks for the help and I hope this question hasn't been solved already, because it would mean my searching skills are terrible hah.

Categories:
I have the same question (0)
  • Verified answer
    v-litu-msft Profile Picture
    on at

     

    I am afraid that add an image into the description field of DevOps Work item is not supported in Power Automate yet.

    As a workaround, you could upload these image files to the attachment.

    Here is a post with the solution, please check it:

    Solved: Send an HTTP request to Azure DevOps - Successfull... - Power Platform Community (microsoft.com)

     

    Best Regards,
    Community Support Team _ Lin Tu
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

    Hi @CatfishLum,

  • Mikael Andersen Profile Picture
    46 on at

    I know this is an old issue and that a solution has already been provided 😉

     

    Below is an alternative solution we've setup as a PoC - seems to work. The main problem is that the Outlook body (HTML) contains CID image references. Further explanation here https://afterlogic.com/docs/mailbee-net-tutorials/display-html-plain-text-message/display-message-with-embedded-pictures#:~:text=CID%20reference%20in%20the%20HTML,HTML%20body%20is%20being%20rendered.

     

    What we do is to iterate through the attachments and replace the CID image references with the base64 encoding of the attachments.

     

    The basic flow looks like this:

    mikael_andersen_0-1701852747146.png

    The Description variable (string) is used to hold the DevOps description.

     

    For each flagges mail we do this:

    mikael_andersen_1-1701852813895.png

    mikael_andersen_4-1701853116109.png

     

    Description is set as follows:

    mikael_andersen_2-1701852845870.png

    Then for each inline attachment we replace the CID reference wit the corresponding base64 embedded image.

    mikael_andersen_3-1701852931160.png

    The replace expression looks like this:

    replace(variables('Description'),concat('cid:',body('Get_Attachment_(V2)')?['contentId']),concat('data:',body('Get_Attachment_(V2)')?['contentType'],';base64, ',body('Get_Attachment_(V2)')?['contentBytes']))
     
    And the variable update is simply set to the output of the compose action.
     
    Finally the Azure DevOps item is created with the Description set to the variable description.
     
    Hope this can help others.
     

     

     

     

  • SergioBlum Profile Picture
    3 on at

    Worked like a charm! Perfect!

    Thanks a lot.

  • Suggested answer
    Kemi Liu Profile Picture
    2 on at
    [UPDATE]

    I just found this workaround has a problem that only the file uploader (the power automate connector account) could see the image, and others can only see a broken image.

    The reason is:
    You need to attach the upload image to a work item, otherwise, others cannot access it.
    https://developercommunity.visualstudio.com/t/vsts-rest-api-upload-attachement-file-issue/100564

    My new approach is to upload the email body attachment to Azure DevOps first and then attach it to the work item. This way, others can view it. To differentiate between inline and non-inline attachments, I will remove inline attachments from the work item after attaching them. This ensures that others can see the images within the email body but won't see them listed as attachments in the work item.

    Now everything works fine!





    -------------------------------------------------------------------------------------------------------------------------------------------------------
    Hi @CatfishLum
     

    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

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 522 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 364 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard