Previous blog post shows how to Use Power Automate to automate the creation of tasks from customer emails requests

All the images are attachments in email content but they are not like file attachments. If you only look the Has Attachments setting to save attachments of an email, you won’t get the pictures saved in your Azure DevOps task. You might want to show the pictures also embedded in the tasks description as they are in the email. You need to do two scopes, one before adding the task into backlog and one after it.

Add pictures embedded in description

Create an apply to each loop for the email Attachment property, and do for each attachment

  • Get the get the attachment bytes with Oulook action
  • Replace email body with base64 code for the attachment contentId
  • Set the replaced string into your actual variable (since Power Automate does not allow you to edit the current variable in expression of setting itself)
replace(variables('EmailBody'),concat('cid:',body('Get_Attachment_(V2)')?['contentId']),concat('data:',body('Get_Attachment_(V2)')?['contentType'],';base64, ',body('Get_Attachment_(V2)')?['contentBytes']))

Add attachments for task

Then you need to loop again all attachments in email after creating the task to add them as file attachments for the Azure DevOps task. It would not be needed for each picture, but in some cases the base64 ending does not work and picture disappears from body. Then it is quite convenient to have the picture as attachment in the task.

First you need to create another apply to each loop with Attachments, and then

  • parse the JSON from the file info
{
    "type": "object",
    "properties": {
        "Id": {
            "type": "string"
        },
        "Name": {
            "type": "string"
        },
        "ContentBytes": {
            "type": "string"
        },
        "ContentType": {
            "type": "string"
        },
        "Size": {
            "type": "integer"
        }
    }
}

After that you need to

  • Send the file bytes to Azure DevOps backlog
binary(body('Parse_file_info')?['ContentBytes'])

And finally

  • Attach the uploaded file to the task you created

Now you have situation where you have pictures embedded in the task body..

..and as attachments in the task.

Solution blog post collection