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??
Hi @SaifAli
Currently adding an attachment as a direct action is not supported in flow. However, you can refer to the thread below where a workaround has been suggested for creating the attachments:
You can post an idea here to include this as a feature in flow:
https://powerusers.microsoft.com/t5/Flow-Ideas/idb-p/FlowIdeas
Hope this Helps!
If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!
Make sure you name everything the exact same thing as what I have if you are copying and pasting from here. You will need to add in your organization name.
The schema is:
{
"type": "object",
"properties": {
"Id": {
"type": "string"
},
"Name": {
"type": "string"
},
"ContentBytes": {
"type": "string"
},
"ContentType": {
"type": "string"
},
"Size": {
"type": "integer"
}
}
}
Then
binary(body('Parse_JSON')?['ContentBytes'])
outputs('Compose')['url']
Then
Hope this helps!
Make sure you name everything the exact same thing as what I have if you are copying and pasting from here. You will need to add in your organization name.
The schema is:
{
"type": "object",
"properties": {
"Id": {
"type": "string"
},
"Name": {
"type": "string"
},
"ContentBytes": {
"type": "string"
},
"ContentType": {
"type": "string"
},
"Size": {
"type": "integer"
}
}
}
binary(body('Parse_JSON')?['ContentBytes'])
outputs('Compose')['url']
Hope this helps!
Thank you for the solution. I implemented your solution and the flow did run successfully, but the file wasn't attached to the work item in Azure DevOps. Can you please advise?
Hi @Anonymous,
Can you send screen shots of your two Http request actions? You have to make sure the first is a POST with the header "Content-Type": "application/octet-stream". The second one has to be a PATCH with the header "Content-Type": "application/json-patch+json"
@Anonymous everything looks good there. Do you mind sending the binary function and the compose functions. You can just send the code. Also what type of files are you sending/how big are they? You may need to change your upload type from simple to chunked. Here is the link if you'd like to read about it.
@Anonymous I see your issue. You are grabbing the wrong body in your first compose. You need to grab the body that the first http request generates.
Thank you @TheSwilliam. I did update the body part, but still the files are not getting attached.
@Anonymous I think you are also grabbing the wrong thing in your compose2. When you peak at the code this is what you should see in your compose 2:
outputs('Compose')['url'])
Thank you so much. I was able to attach the file to the Work Item in Azure DevOps.
Is there any reason why Post Attachment isn't an option for me? I'm just using the pro trial right now, but is it possible our instance of Azure Devops might be limiting functionality in some way?
@Anonymous I believe you would need Azure DevOps Premium connector to implement this functionality.
@Anonymous I renamed the ‘send an http request to azure devops’ action to ‘Post Attachment’ that’s why it isn’t showing up for you. Just use send an http request to azure devops and you’ll be good
Nice solution and worked flawlessly for my flow.
Thanks!
Great tutorial, I'm getting error and i have tried everything not sure why i'm getting it as followed the instructions closely:
You must pass a valid patch document in the body of the request. I am testing with a .xlsx
Azure DevOps ActivityId: 4bbf592f-9f6d-4b1b-9b37-64c3fab79e50
Details: {"$id":"1","innerException":null,"message":"You must pass a valid patch document in the body of the request.","typeName":"Microsoft.VisualStudio.Services.Common.VssPropertyValidationException, Microsoft.VisualStudio.Services.Common","typeKey":"VssPropertyValidationException","errorCode":0,"eventId":3000}
clientRequestId: eaa606b1-3ae9-4041-8b18-27309ce4f369
Here is what i have in the body:
[
{
"op:"add",
"path":"/relations/-",
"value":{
"rel":"AttachedFile",
"url":"@{outputs('Compose_2')}",
"attributes":{
"comment":"Adding attachments"
}
}
}
]
Any help would be appreciated it.
Great tutorial, I'm getting error and i have tried everything not sure why i'm getting it as followed the instructions closely:
You must pass a valid patch document in the body of the request. I am testing with a .xlsx
Azure DevOps ActivityId: 4bbf592f-9f6d-4b1b-9b37-64c3fab79e50
Details: {"$id":"1","innerException":null,"message":"You must pass a valid patch document in the body of the request.","typeName":"Microsoft.VisualStudio.Services.Common.VssPropertyValidationException, Microsoft.VisualStudio.Services.Common","typeKey":"VssPropertyValidationException","errorCode":0,"eventId":3000}
clientRequestId: eaa606b1-3ae9-4041-8b18-27309ce4f369
Here is what i have in the body:
[
{
"op:"add",
"path":"/relations/-",
"value":{
"rel":"AttachedFile",
"url":"@{outputs('Compose_2')}",
"attributes":{
"comment":"Adding attachments"
}
}
}
]
Any help would be appreciated it.
User | Count |
---|---|
16 | |
16 | |
14 | |
9 | |
8 |
User | Count |
---|---|
27 | |
26 | |
24 | |
23 | |
15 |