Hello community,
I'm trying to mention a user when creating a post in a Teams channel using ChatOps.
Using https://learn.microsoft.com/en-us/microsoftteams/platform/task-modules-and-cards/cards/cards-format?tabs=adaptive-md%2Cdesktop%2Cconnector-html#microsoft-entra-object-id-and-upn-in-user-mention, I managed to create this:
var adaptiveCardBody = new List<AdaptiveElement>()
{
new AdaptiveTextBlock("Hello <at>Mauro Druwel</at>")
{
Wrap = true,
AdditionalProperties = new AdaptiveCards.SerializableDictionary<string, object>
{
{
"msteams", new
{
entities = new List<object>
{
new
{
type = "mention",
text = "<at>Mauro Druwel</at>",
mentioned = new
{
id = "mauro.druwel@skyline.be",
name = "Mauro Druwel",
},
},
}
}
},
},
},
};
This should tag the user; unfortunately, it is not working. How can I resolve this?
Hi Mauro,
Your approach was almost correct, the only difference is that msteams, as shown in the MS Docs that you've linked, should be defined next to the body of an adaptive card and not inside of it in AdditionalProperties . That is why it's currently not possible/supported with Chat Integration.
Depending on what you try to achieve, you could also send the user a private chat notification (about the post).
With Kind regards