简体   繁体   中英

Microsoft adaptive card

How to send an adaptive card to Microsoft teams channel via SMTP. I am trying to pass Json through the string in c# via SMTP and send mail directly to the team's channel

 string Message = @"{
'type': 'AdaptiveCard',
'body': [
    {
        'type': 'Container',
        'items': [
            {
                'type': 'TextBlock',
                'text': 'Test',
                'color': 'Attention',
                'wrap': true
            }
        ],
        'bleed': true
    }
],
'$schema': 'http://adaptivecards.io/schemas/adaptive-card.json',
'version': '1.0'}";

_emailSender.SendEmailAsync("abct@apac.teams.ms", user.Email, "Title", Message);

You should use double quotes " instead single quotes '

You can paste this fixed JSON in Microsoft adaptative designer and check the result.

{
    "type": "AdaptiveCard",
    "body": [
        {
            "type": "Container",
            "items": [
                {
                    "type": "TextBlock",
                    "text": "Test",
                    "color": "Attention",
                    "wrap": true
                }
            ],
            "bleed": true
        }
    ],
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"version": "1.0"
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM