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

Attachments to Azure DevOps

Hi,

So i've been working on a scenario where i have to upload an attachment coming from email to Azure DevOps ticket,

I've read a lot of similar threads but didn't got any success anywhere, after some discussions and research i've finally developed 2 flows ( since i'm just researching on it, will combine them later ) one which gives the URL of the attachment uploaded and the other one which actually uploads the attachment as can be seen below : 

 

I've taken the help of Microsoft docs : 

https://docs.microsoft.com/en-us/rest/api/azure/devops/wit/attachments/create?view=azure-devops-rest...

https://docs.microsoft.com/en-us/rest/api/azure/devops/wit/work%20items/update?view=azure-devops-res...

 

The problem i'm facing is that i'm passing "Attachment Content" in the body of the http request while uploading the attachment. Thus the final uploaded attachment after the running of 2 flows is in encoded format also can be seen below :Attachment.PNG

Flow 1.PNGFlow 2.PNG

2 REPLIES 2
Community Support
Community Support

 

Hi @SaifAli ,

 

It seems that what is needed here is the binary file. Please consider using base64ToBinary() function to convert the string.

1.PNG

Image reference:

2.PNG

Hope it helps.

 

Best Regards,

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

@v-bacao-msft, Thanks for your help, but unfortuanately it didn't worked somehow.

 

When i tried with the compose step and used below expression there

"base64ToBinary(Items('Apply_to_each')?['ContentBytes'])"

can be seen below in the screenshot after one refresh it got changed to "Attachment Content" in place of expression. and then the input and output becomes same again also can be seen below 

 

Later i tried to directly pass the base64 string to the function but it is giving me expression invalid error, seems to me that it is because the base 64 string is really long. Any suggestions here??

 

Added the expression "base64ToBinary(Items('Apply_to_each')?['ContentBytes'])"Added the expression "base64ToBinary(Items('Apply_to_each')?['ContentBytes'])"Automatically changing to "Attachment Content"Automatically changing to "Attachment Content"while directly putting the base 64 encoded stringwhile directly putting the base 64 encoded string

Helpful resources

Announcements
PP Bootcamp Carousel

Global Power Platform Bootcamp

Dive into the Power Platform stack with hands-on sessions and labs, virtually delivered to you by experts and community leaders.

secondImage

Power Platform Community Conference On Demand

Watch Nick Doelman's session from the 2020 Power Platform Community Conference on demand!

MPA Community Blog

Power Automate Community Blog

Check out the community blog page where you can find valuable learning material from community and product team members!

Top Solution Authors
Users online (5,018)