Skip to content

/commands/teams/set-csteamsmessagingpolicy

Set-CsTeamsMessagingPolicy: change Teams chat settings (edit, delete, Giphy, read receipts)

verified onenvironmentlocal · windows 10.0.26200 arm64 · GNU bash 5.3.15 (Git Bash)updated
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:

powershell
Get-CsTeamsMessagingPolicy -Identity Global
Set-CsTeamsMessagingPolicy -Identity Global -AllowUserEditMessage $false

Only the settings you pass change. To give a subset of users different settings, create a custom policy and assign it:

powershell
New-CsTeamsMessagingPolicy -Identity StudentMessagingPolicy -AllowGiphy $false -AllowMemes $false
Grant-CsTeamsMessagingPolicy -Identity student@contoso.com -PolicyName StudentMessagingPolicy

You need the Teams Administrator role.

Common settings

ParameterValuesEffect
-AllowUserEditMessage$true / $falseUsers can edit their own messages
-AllowUserDeleteMessage$true / $falseUsers can delete their own messages
-AllowOwnerDeleteMessage$true / $falseTeam 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, NORESTRICTIONGiphy in chats and its content rating
-AllowMemes, -AllowStickers$true / $falseMemes and stickers
-AllowUrlPreviews$true / $falseLink previews
-ReadReceiptsEnabledTypeUserPreference, Everyone, NoneWho 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):

powershell
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

powershell
Get-CsUserPolicyAssignment -Identity anna@contoso.com -PolicyType TeamsMessagingPolicy

To remove a custom assignment: Grant-CsTeamsMessagingPolicy -Identity anna@contoso.com -PolicyName $null.

Sources