SOLVED

Get Teams chat ID

Iron Contributor

Hi,

I'm developing some alarmistic in Powershell, which to this day, sends the alerts over email.

But I would like to send the alarmistic also to a Teams chat (not a group). I've found a script that can send over the alerts to a Teams chat, but requires the chat id.

I have found a way to get a Teams Group ID (using powershell comand Get-Team -DisplayName "Groupname"), but don't know how to get the ID for a chat.

Can anyone help me to understand how can I get the chat ID?
Thanks

4 Replies
Thanks for the reference. But when I run it, I've got an error: "Get-MgUserChat : Missing scope permissions on the request. API requires one of 'Chat.ReadBasic, Chat.Read, Chat.ReadWrite'. Scopes on the request 'AuditLog.Read.All, openid, profile, User.Read, User.Read.All, email'"
How can I set this scope on Powershell? Never done this before.
best response confirmed by dmarquesgn (Iron Contributor)
Solution
You have to connect like this

Connect-MgGraph -Scopes "User.Read.All", "Group.ReadWrite.All,Chat.Read,Chat.ReadWrite,ChatMember.ReadWrite,Chat.ReadBasic"

@Andres Gorzelany 

Hi, thanks for the reference, never used it like that, but worked like a charm.

1 best response

Accepted Solutions
best response confirmed by dmarquesgn (Iron Contributor)
Solution
You have to connect like this

Connect-MgGraph -Scopes "User.Read.All", "Group.ReadWrite.All,Chat.Read,Chat.ReadWrite,ChatMember.ReadWrite,Chat.ReadBasic"

View solution in original post