Azure DevOps work items from Microsoft Teams using Plumsail Forms and Power Automate

@IliaLazarevskii Your blog listed here is missing a step in the article. You documented all other step except this one:

What do I do to get the attachments linked to the original work item? Thanks.

Hi @ParAvion,

Thank you for noticing! I can't believe I missed this part, I'll be sure to fix the article.

To connect the attachment to the item, send a PATCH request like so:

The URI is simple, just replace the beginning of the link and put the item ID in the right place:

https://dev.azure.com/plumsail/Forms/_apis/wit/workitems/@{outputs('Create_a_work_item')?['body/id']}?api-version=5.1

JSON schema is the most important part, it should look like this:

[
  {
    'op': 'add',
    'path': '/relations/-',
    'value': {
      'rel': 'AttachedFile',
      'url': '@{body('Parse_JSON')?['url']}',
      'attributes': {
        'comment': 'Bug details',
        'name':'@{items('Apply_to_each')?['file']}'
      }
    }
  }
]

Make sure to change Parse_JSON and Apply_to_each to the names of the corresponding actions in your flow.

1 Like