Skip to content

Commit 8f30436

Browse files
authored
Merge pull request #310 from microsoftgraph/po/teamsMentionSample
Add sample to mention a user on Teams.
2 parents 7c0e0d9 + fa126c5 commit 8f30436

File tree

2 files changed

+23
-10
lines changed

2 files changed

+23
-10
lines changed

samples/5-Chats.ps1

Lines changed: 0 additions & 10 deletions
This file was deleted.

samples/5-Teams.ps1

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Teams Chat snippets
2+
3+
# Get list of 1:1 chats
4+
Get-MgChat
5+
6+
# Get Messages from Chat
7+
Get-MgChatMessage -chatId $chatId
8+
9+
# Send a message in that 1:1 chat
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)