0
votes

It seams that msteams object doesn't allow to render date, when card pushed through graph api in private msteams channel.

Example is like this:

POST https://graph.microsoft.com/v1.0/teams/{team_id}/channels/{channel_id}/messages
{
  "body": {
        "contentType": "html",
        "content": "<attachment id=\"1\"/>"
  },
    "attachments":[
        {
            "contentType":"application/vnd.microsoft.card.adaptive",
            "id":"1",
            "content":"{\"type\":\"AdaptiveCard\",\"body\":[{\"text\":\"<at>Lev</at> hello {{ DATE(2021-04-28T00:00:00Z, SHORT) }}\",\"wrap\":true,\"type\":\"TextBlock\"}],\"version\":\"1.3\",\"msteams\":{\"entities\":[{\"type\":\"mention\",\"text\":\"<at>Lev</at>\",\"mentioned\":{\"id\":\"29:131...Rg\",\"name\":\"Lev\"}}]}}"
        }
    ]
}

Example in teams

Is there some workaround?

2

2 Answers

0
votes

msteams object is not allowed through Graph API. Only Bots have access to the msteams object. This is by design. The at mention object when you send from bot, the user will get notify in teams activity and the card will display as shown in below image

enter image description here

and the at mention in adaptive card using graph api post request, the user will not get notify in teams activity and the card will display as shown in below image enter image description here

0
votes

Please check the below request body

{
    "body": {
        "contentType": "html",
        "content": "<attachment id=\"1\"/>"
    },
    "attachments": [
        {
            "contentType": "application/vnd.microsoft.card.adaptive",
            "id": "1",
            "content": "{    \"$schema\": \"http://adaptivecards.io/schemas/adaptive-card.json\",    \"type\": \"AdaptiveCard\",    \"version\": \"1.0\",    \"body\": [        {            \"type\": \"TextBlock\",            \"text\": \"Your package will arrive on {{DATE(2017-02-14T06:00:00Z, SHORT)}} at {{TIME(2017-02-14T06:00:00Z)}}\",            \"wrap\": true        }    ]}"
        }
    ]
}

enter image description here