MicrosoftDocs / AdaptiveCards

Docs for Adaptive Cards
https://docs.microsoft.com/en-us/adaptive-cards/
Creative Commons Attribution 4.0 International
72 stars 138 forks source link

Can we have file attachment within the adaptive card? #237

Open aratigurav opened 4 years ago

matthidinger commented 4 years ago

If the file is available at a URL that the user can access, you could use an Action.OpenUrl with the url property set to the file location.

{
   "type": "Action.OpenUrl",
   "title": "Download",
   "url": "https://url-to-file"
}

You could also use markdown in a TextBlock to achieve the same thing:

{ 
   "type": "TextBlock",
   "text": "Click [here](https://url-to-file)To download"
}
unlimitedduck commented 4 years ago

@matthidinger looking at hooking up an adaptive card with Power Automate to send get a response from a user in Teams. What I'm after is can I have in the Adaptive Card a way for the user to attach an attachment and then the response via the adaptive card send the attachment to a SharePoint specific list row. Appreciate your time.

pparthenhs commented 5 months ago

Greeting dear community,

I hope you are doing well and continue coding 🚀

Our team and I, are facing the same issue.

Long story short, we have a service that generates report files, the types of those reports are :

Regarding the image report, we created a POST on Teams' channel by transforming the image to base64 format. In more detail, we accomplish that by executing a POST HTTP request to the MS Teams webhook mechanism using the JSON below as the HTTP body.

{
  "type": "message",
  "attachments": [
    {
      "contentType": "application/vnd.microsoft.card.adaptive",
      "content": {
        "type": "AdaptiveCard",
        "body": [
          {
            "type": "TextBlock",
            "text": "Hello, this is a message with an attached image file!",
            "wrap": false
          },
          {
            "type": "Image",
            "url": "{{base64}}",
            "wrap": true
          }
        ]
      }
    }
  ]
}

Is there any efficient way to include also the Excel and CSV reports in the POST on Teams' channel ?? (Without uploading those reports to the server and attaching them using URLs)

I remain at your disposal for any ideas, comments, or proposals.

Thank you and appreciate your time and effort in advance 🙏