Search code examples
c#botframeworkmicrosoft-teams

Mention a Teams tag in an adaptive card


Using the bot framework I am trying to mention a Teams tag in an adaptive card text block. Mentioning a user by e-mail works as expected. When I try to mention a tag by its ID it does not work, it does not result in a mention.

Unless the format of the entity for tag has to be different, I cannot see what I am doing incorrect here.

See the below how I construct the adaptive card (using the AdaptiveCards NuGet package).

new AdaptiveCard(new AdaptiveSchemaVersion(1, 2))
{
    Body = new List<AdaptiveElement>
    {
        new AdaptiveTextBlock
        {
            Text = "Mention test: <at>mytag</at>"
        }
    },
    AdditionalProperties = new SerializableDictionary<string, object>()
    {
        {
            "msteams",
            new
            {
                width = "full", 
                entities = new []
                {
                    new Mention()
                    {
                        // Does work when a e-mail is mentioned, but not when I use a Teams tag ID
                        Mentioned = new ChannelAccount("[email protected]", "mytag"),
                        Text = "<at>mytag</at>"
                    }
                }
            }
        }
    }
};

Solution

  • At the time of writing this is not possible. I submitted feedback requesting this feature.

    https://feedbackportal.microsoft.com/feedback/idea/daeb1976-f010-ee11-a81c-000d3a7a48db

    A workaround I found is using the Microsoft Graph API to request a list of members in a tag. Then mention all the individual members (by e-mail) in the adaptive card using an invisible TextBlock.