Add Email Attachments to DevOps Work Items Using Power Automate

This article assumes you know how to implement the following steps first:

  1. When a new email arrives (V3) - Outlook 365 action
  2. Create a work item - DevOps action
  3. Apply to each using Attachments list - Outlook 365 dynamic content item
    • Send HTTP POST request to DevOps to upload the attachment file content - DevOps action
    • Parse JSON - regular action
    • Send 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:

  1. Organization Name - your org name
  2. Method - POST
  3. Relative URI - /_apis/wit/attachments?filename=[Attachment Name dynamic content item]&api-version=7.1
  4. Headers - Only one header: content-type of value items('Apply_to_each')?['contentType']
  5. Body - binary(items('Apply_to_each')?['contentBytes'])
  6. Body is Base64: Yes

References

Popular posts from this blog

SharePoint PowerShell Quick Guide

Dependency Injection in .NET

Git Guide