首页 > 解决方案 > 如何通过 Action.Http 获取 TextBlock 文本?

问题描述

单击发送反馈时,我试图获取 TextBlock 文本/值(“单击了解更多以了解有关可操作消息的更多信息!)作为响应。我尝试了 {{Heading.text}}{{Heading.value}},标题为 id的一个领域。

自适应卡

通过{{feedbackText.value}}从Input.Text获取价值就可以了。

样本:

{
"type": "AdaptiveCard",
"version": "1.0",
"hideOriginalBody": true,
"body": [
    {
        "type": "TextBlock",
        "text": "Visit the Outlook Dev Portal",
        "size": "Large"
    },
    {
        "type": "TextBlock",
        "text": "Click **Learn More** to learn more about Actionable Messages!",
        "id": "Heading"
    },
    {
        "type": "Input.Text",
        "id": "feedbackText",
        "placeholder": "Let us know what you think about Actionable Messages"
    }
],
"actions": [
    {
        "type": "Action.Http",
        "title": "Send Feedback",
        "method": "POST",
        "url": "https://webhook.site/.....",
        "body": "{{feedbackText.value}}\n{{Heading.text}}\n{{Heading.value}}"
    },
    {
        "type": "Action.OpenUrl",
        "title": "Learn More",
        "url": "https://docs.microsoft.com/outlook/actionable-messages"
    }
],
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json"}

感谢帮助。

标签: adaptive-cards

解决方案


我在尝试在 http 正文中发送文本块的值时遇到了同样的问题。我使用了以下解决方法:

  1. 创建了一个 Input.Number 字段
  2. 将 Initially Visible 属性设置为 false
  3. 撰写自适应卡时,我使用逻辑应用程序/流来填充字段的值
  4. 然后将 Action.Http 设置为输入框的 id.value 值。

推荐阅读