cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
SaifAli
Helper III
Helper III

Adding the attachments to Azure DevOps work item in "Create a Work item" step

Hi ,

 

Is there a way to attach a certain file from email directly to the attachments section in the User story of Azure DevOps, I'm currently having a flow that creates a work item whenever tehre is a new email but can't able to process the attachments linked to it. I need those attachments in the user story itself. Can somebody help me??

54 REPLIES 54
npu_2022
Regular Visitor

Hi @TheSwilliam @gyegan @Anonymous or anyone else who had luck with this. This looks like an awesome solution and I am really hoping to get this implemented however, I am running into an issue with the second compose action.

 

My output does not list URL and only output. Any suggestion on how to resolve this? Note - Below is my desired outcome. Thanks in advance!

 

npu_2022_1-1641924724746.png

 

Were you able to resolve this? I am also unable to see 'url' as an option for 'compose 2'.

TheSwilliam
Frequent Visitor

@npu_2022 @HerbsterK The 'url' is actually an output function: outputs('Compose')['url'] The outputs function is getting the url property from the response json from Post Attachment. Code snippets for the compose steps: Compose: { "inputs": "@body('Post_Attachment')" } Compose 2 { "inputs": "@outputs('Compose')['url']" }

RichardTodd_0-1649650405073.png

I've just implemented the flow. Flow isn't showing me the nice 'url' to pick from the Dynamic list, so adding an Expression and just typing in the text as per @TheSwilliam works.  It turned 'pink' after saving/reopening the flow.

sreel
New Member

Thank you so much. this worked perfectly for me @TheSwilliam 

I am receiving the below error while running the flow, could you please check 

"Unable to process template language expressions in action 'Post_Attachment' inputs at line '0' and column '0': 'The template language function 'binary' was invoked with a parameter that is not valid. The value cannot be converted to the target type.'."

 

SwathiB_1-1659092358428.png

SwathiB_2-1659092404843.png

 

 

Hello TheSwilliam could you help me, I am trying to create this request for "CHUNKED UPLOAD" but I can't get a return, even if I use the upload type as chunked the activity doesn't return the necessary ID, I can do the flow for the attachments that are smaller but the bigger ones I can't upload. Your example is very similar to the one I did for the smaller file uploads, but I would like to ask for your help to try to verify what I might have done wrong in this step

The documentation says that we should start the upload [POST] and then perform a [PUT] with the ID that the first activity provides, but my flow does not go beyond the PUT activity, the error is related to the size of my file and I need to upload that..

Ludsons_1-1660588854250.png

 

 

Thanks... going back to a few questions back...

Do you know how to get images in the body of the email to show up in the DevOps bug?

EX:

Sucupira_0-1660772177664.png

 

Or its not possible yet?

nerfherder
Advocate II
Advocate II

@TheSwilliam i presume this worked at one point, but now I am getting the same "Unable to process template language expressions in action 'Post_Attachment' inputs at line '0' and column '0': 'The template language function 'binary' was invoked with a parameter that is not valid. The value cannot be converted to the target type" error as @SwathiB et al. Appreciate the detail and effort you put into this. It needs an update.

nerfherder
Advocate II
Advocate II

nerfherder_0-1664840661291.png

Here is a screenshot of the outputs of the "Current Item." I don't see the word "ContentBytes" anywhere, presumably that is why the binary (and base64) expressions are failing. Gotta love those updates!

 

nerfherder
Advocate II
Advocate II

Resolved by creating a control that looks for PDFs, which can be uploaded via HTTP Request to Azure DevOps action. If not PDF, iterates thru the various content types and uploads.

nerfherder_1-1664846677514.png

 

^ The dynamic content in the control is "Attachments Content-Type". Mixed and matched the puzzle pieces from the two resources below.

 

Sources:

Image attachments - 

https://powerusers.microsoft.com/t5/Using-Flows/Add-image-attachment-to-sharepoint/td-p/399520 & 

PDF Attachments - 
 
@SwathiB fyi this should work for you too
nerfherder
Advocate II
Advocate II

there's nothing special in Compose 4 i was using it to troubleshoot

nerfherder
Advocate II
Advocate II

The PDF attachment link is not to clear, basically do the above procedure, but use base64 expression instead of binary

It was due to a typo and it's working perfectly fine for me after I made the correction.

I corrected my typo error and its working for me now 🙂

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Users online (5,218)