BotFrameworkV4-图像未在Microsoft Teams的自适应卡中显示

时间:2020-07-01 06:55:58

标签: json image botframework microsoft-teams adaptive-cards

我刚开始使用BotFramework。我正在尝试在Microsoft Teams中显示自适应卡,并且正在使用从https://github.com/microsoft/BotBuilder-Samples/tree/master/samples/csharp_dotnetcore/50.teams-messaging-extensions-search

下载的代码

我看到响应JSON中返回的图像URL是正确的,我可以将其粘贴到浏览器中,并且图像显示得很好,但是在卡中,图像显示为“未定义”。我看到团队将URL更改为-https://urlp.asm.skype.com/v1/url/content?url=[original_url]

我尝试将Azure Blob防火墙设置更改为“允许所有网络”,并将我的应用程序域和urlp.asm.skype.com添加到manifest.json的validDomains[]配置中,但是我还是我的图片有问题。

enter image description here

我正在使用的JSON如下- $ {thumbnailurl}包含缩略图的网址。

{
  "type": "AdaptiveCard",
  "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
  "version": "1.2",
  "backgroundImage": "https://www.beautycolorcode.com/abcdef.png",
  "body": [
    {
      "type": "Container",
      "items": [
        {
          "type": "ColumnSet",
          "columns": [
            {
              "type": "Column",
              "width": "auto",
              "items": [
                {
                  "type": "Image",
                  "size": "large",
                  "style": "default",
                  "width": "100px",
                  "spacing": "extraLarge",
                  "url": "http://<myHostname>/xdownload/thumbnail/%257B%2522app%2522%253A%2522NH-vanilla-search%2522%252C%2522id%2522%253A%2522%255C%252FFS%255C%252FDemo%2BFiles%255C%252F%257CEnron%2BData%255C%252Fenron1992.pdf%2522%257D/file.jpg"
                }
              ]
            },
            {
              "type": "Column",
              "width": "stretch",
              "items": [
                {
                  "type": "TextBlock",
                  "text": "Enron Documents 1992 ENRON CORP",
                  "wrap": true,
                  "color": "accent",
                  "size": "medium",
                  "weight": "bolder",
                  "spacing": "padding",
                  "fontType": "default",
                  "horizontalAlignment": "left"
                }
              ]
            }
          ]
        }
      ]
    },
    {
      "type": "Container",
      "items": [
        {
          "type": "TextBlock",
          "text": "DC 20585 | 5 -- ': ... L. Lay Chairman and CEO **Enron** Corporation\r\nP.O. Box 1188 Houston, ... 1992, and for your comments... fired\r\nelectricity generation over the ... gas prices currently offered by\r\n**Enron** and others. Natural gas power ... coal or nuclear plants. In\r\naddition... America's strengths to achieve aggressive ... L. Lay,\r\nchairman and CEO of **Enron** Corp., in testimony today before the ...\r\nproductivity, prosperity and global leadership\r\n",
          "wrap": true,
          "maxLines": 6,
          "spacing": "padding",
          "fontType": "default",
          "weight": "default",
          "size": "small"
        }
      ]
    },
    {
      "type": "FactSet",
      "facts": [
        {
          "title": "Source:",
          "value": "\r\n  /File System/Sample Data/Enron Data/\r\n"
        },
        {
          "title": "Format:",
          "value": "pdf"
        },
        {
          "title": "Relevancy:",
          "value": "85.04401%"
        }
      ],
      "separator": true,
      "spacing": "extraLarge"
    }
  ],
  "actions": [
    {
      "type": "Action.OpenUrl",
      "title": "Document Preview",
      "url": "http://<myHostname>/app/NH-vanilla-search/#/preview?id=%2FFS%2FDemo+Files%2F%7CEnron+Data%2Fenron1992.pdf&query=%7B%22name%22%3A%22Custom_Query%22%2C%22text%22%3A%22enron+data%22%7D",
      "style": "positive",
      "width": "stretch"
    }
  ]
}

非常感谢您在这里的投入。 谢谢!

1 个答案:

答案 0 :(得分:0)

团队无法访问该图像。您几乎希望任何通道客户端显示的任何图像都需要公开访问。使用公共图片网址。