```sh Install-Module Microsoft.Graph -Scope CurrentUser Install-Module Microsoft.Graph.Beta Import-Module Microsoft.Graph -Scope CurrentUser # Connect to MgGraph Connect-MgGraph Find-MgGraphCommand -command Get-MgUser | Select -First 1 -ExpandProperty Permissions #Grant permission Connect-MgGraph -Scopes "User.Read.All","Group.ReadWrite.All" $user = Get-MgUser -Filter "displayName eq 'Raj'" # Get Teams for user Get-MgUserJoinedTeam -UserId $user.Id # Get Teams for user $TeamId=$(Get-MgUserJoinedTeam -UserId $user.Id).ID $team = Get-MgTeam -TeamId $TeamId # Get Team channel for specific Team $channel = Get-MgTeamChannel -TeamId $team.Id -Filter "displayName eq 'General'" # Post message in specific Team channel New-MgTeamChannelMessage -TeamId $team.Id -ChannelId $channel.Id -Body @{ Content="Hello Teams"} # Post message in specific Team channel New-MgTeamChannelMessage -TeamId $team.Id -ChannelId $channel.Id -Body @{ Content="Hello World" } -Importance "urgent" # DisConnect to MgGraph Disconnect-MgGraph ```
Azure Cloud Solution Architect, Full-Stack Development in .Net Eco system, Senior Manager at Capgemini
Saturday, September 2, 2023
Post message using Microsoft Graph powershell moduel
Post message using Microsoft Graph powershell moduel <\i>
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment