Add Email Attachments to DevOps Work Items Using Power Automate
This article assumes you know how to implement the following steps first:
When a new email arrives (V3)
- Outlook 365 actionCreate a work item
- DevOps actionApply to each
using Attachments list - Outlook 365 dynamic content itemSend HTTP POST request to DevOps
to upload the attachment file content - DevOps actionParse JSON
- regular actionSend HTTP POST request to DevOps
to associate uploaded file to the work item - DevOps action
There is an issue at step 3. a
where the attachment is being uploaded. Attachments can be of various content types, and additionally (but separately) you are having to decide whether the body is Base64 or not.
Here's what you do:
- Organization Name - your org name
- Method - POST
- Relative URI -
/_apis/wit/attachments?filename=[Attachment Name dynamic content item]&api-version=7.1
- Headers - Only one header:
content-type
of valueitems('Apply_to_each')?['contentType']
- Body -
binary(items('Apply_to_each')?['contentBytes'])
- Body is Base64:
Yes