/commands/teams/set-csteamsmessagingpolicy
Set-CsTeamsMessagingPolicy: change Teams chat settings (edit, delete, Giphy, read receipts)
- tool
- Microsoft Teams PowerShell
- versions
- MicrosoftTeams 8.0.0
- os
- windows, linux, macos
Messaging policies control what users can do in Teams chats and channel messages. Change the org-wide default (the Global policy) after Connect-MicrosoftTeams:
Get-CsTeamsMessagingPolicy -Identity Global
Set-CsTeamsMessagingPolicy -Identity Global -AllowUserEditMessage $falseOnly the settings you pass change. To give a subset of users different settings, create a custom policy and assign it:
New-CsTeamsMessagingPolicy -Identity StudentMessagingPolicy -AllowGiphy $false -AllowMemes $false
Grant-CsTeamsMessagingPolicy -Identity student@contoso.com -PolicyName StudentMessagingPolicyYou need the Teams Administrator role.
Common settings
| Parameter | Values | Effect |
|---|---|---|
| -AllowUserEditMessage | $true / $false | Users can edit their own messages |
| -AllowUserDeleteMessage | $true / $false | Users can delete their own messages |
| -AllowOwnerDeleteMessage | $true / $false | Team owners can delete any message in their team |
| -AllowUserChat | $true / $false | $false turns off private, group and meeting chat |
| -AllowGiphy / -GiphyRatingType | $true / $false; STRICT, MODERATE, NORESTRICTION | Giphy in chats and its content rating |
| -AllowMemes, -AllowStickers | $true / $false | Memes and stickers |
| -AllowUrlPreviews | $true / $false | Link previews |
| -ReadReceiptsEnabledType | UserPreference, Everyone, None | Who controls read receipts |
The parameters and their types in MicrosoftTeams 8.0.0 (Boolean switches are nullable, so leaving one out keeps the current value):
Import-Module MicrosoftTeams
$p = (Get-Command Set-CsTeamsMessagingPolicy).Parameters
foreach ($n in 'Identity','AllowUserEditMessage','AllowUserDeleteMessage','AllowOwnerDeleteMessage','AllowUserChat','AllowGiphy','GiphyRatingType','ReadReceiptsEnabledType') {
$t = $p[$n].ParameterType
if ($t.IsGenericType) { $t = 'Nullable ' + $t.GetGenericArguments()[0].Name } else { $t = $t.Name }
'{0,-24} {1}' -f $n, $t
}Output
Identity String AllowUserEditMessage Nullable Boolean AllowUserDeleteMessage Nullable Boolean AllowOwnerDeleteMessage Nullable Boolean AllowUserChat Nullable Boolean AllowGiphy Nullable Boolean GiphyRatingType String ReadReceiptsEnabledType String
GiphyRatingType and ReadReceiptsEnabledType are plain strings in the module (no validation set), so PowerShell does not check the spelling before the call; copy the values from the table.
Check what a user gets
Get-CsUserPolicyAssignment -Identity anna@contoso.com -PolicyType TeamsMessagingPolicyTo remove a custom assignment: Grant-CsTeamsMessagingPolicy -Identity anna@contoso.com -PolicyName $null.