Forum Discussion
dmarquesgn
Mar 17, 2023Iron Contributor
Get Teams chat ID
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
- You have to connect like this
Connect-MgGraph -Scopes "User.Read.All", "Group.ReadWrite.All,Chat.Read,Chat.ReadWrite,ChatMember.ReadWrite,Chat.ReadBasic"
- You can get a list of chats using Get-MgUserChat https://learn.microsoft.com/en-us/powershell/module/microsoft.graph.teams/get-mguserchat?view=graph-powershell-1.0
- dmarquesgnIron ContributorThanks 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.- You have to connect like this
Connect-MgGraph -Scopes "User.Read.All", "Group.ReadWrite.All,Chat.Read,Chat.ReadWrite,ChatMember.ReadWrite,Chat.ReadBasic"