Skip to content

Commit 4db6d4a

Browse files
committed
Add sample to mention a user on Teams.
1 parent 7c0e0d9 commit 4db6d4a

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

samples/5-Chats.ps1

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,17 @@ Get-MgChat
77
Get-MgChatMessage -chatId $chatId
88

99
# Send a message in that 1:1 chat
10-
New-MgChatMessage -chatId $chatId -BodyContent "Hi from VSCode again!"
10+
New-MgChatMessage -chatId $chatId -BodyContent "Hi from VSCode again!"
11+
12+
# Mention a user in a channel message.
13+
$UserToMention = Get-MGUser -UserId $userUPN
14+
15+
New-MgTeamChannelMessage -ChannelId $ChannelId -TeamId $TeamId `
16+
-BodyContentType "html" `
17+
-BodyContent "Welcome to the channel! <at id='0'>$($UserToMention.DisplayName)</at>" `
18+
-Mentions @( `
19+
@{ `
20+
id = 0; `
21+
mentionText = $UserToMention.DisplayName; `
22+
mentioned = @{user = $UserToMention } `
23+
})

0 commit comments

Comments
 (0)