Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.6k views
in Technique[技术] by (71.8m points)

microsoft teams - Using MS Graph Explorer to Send a Adaptive Card to a Channel - Can I Remove the Padding at the Top?

I'm using the MS Graph API Explorer to send messages to Channels in Teams, but whenever I send a message with an Adaptive Card attached, it adds padding to the top of the card and a 3-dot menu on the right with a "Copy" option.

The examples in Microsoft's documentation do not seem to have this problem.

Image of Card in Teams with extra padding at top

Is there a way to remove this padding and menu? or can I alter the content shown in this space?

I'm using the following endpoint... https://graph.microsoft.com/v1.0/teams/{team-id}/channels/{channel-id}/messages

With the following request body...

{
  "body": {
    "contentType": "html",
    "content": "<attachment id="4465B062-EE1C-4E0F-B944-3B7AF61EAF40"></attachment>"
  },
  "attachments": [
    {
      "id": "4465B062-EE1C-4E0F-B944-3B7AF61EAF40",
      "contentType": "application/vnd.microsoft.card.adaptive",
      "content": "{
        "type": "AdaptiveCard",
        "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
        "version": "1.3",
        "body": [
          {
            "type": "TextBlock",
            "size": "Large",
            "weight": "Bolder",
            "text": "My News Item",
            "wrap": true
          }
        ],
        "actions": [
          {
            "type": "Action.OpenUrl",
            "title": "View",
            "url": "https://bing.com"
          }
        ]
      }"
    }
  ]
}
question from:https://stackoverflow.com/questions/65936168/using-ms-graph-explorer-to-send-a-adaptive-card-to-a-channel-can-i-remove-the

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

For now, this is not possible.

According to Microsoft, this is by-design....

Link to Microsoft Tech Community Discussion

I have added a uservoice suggestion for Microsoft, to expand the schema to include options to do this. If you end up having the same issue as me, at least you can add weight to this feature request...

Link to Microsoft Uservoice Suggestion


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...