Skip to content

Set-MSTTeam

Teams: Updates properties of a team

#Requires -Version 5.1

[CmdletBinding()]
Param(
    [Parameter(Mandatory = $true)]
    [string]$GroupId,
    [ValidateLength(5, 256)]
    [string]$DisplayName,
    [ValidateLength(0, 1024)]
    [string]$Description,
    [string]$MailNickName,
    [ValidateSet('Public', 'Private')]
    [string]$Visibility,
    [bool]$AllowAddRemoveApps,
    [bool]$AllowChannelMentions,
    [bool]$AllowCreateUpdateChannels,
    [bool]$AllowCreateUpdateRemoveConnectors,
    [bool]$AllowCreateUpdateRemoveTabs,
    [bool]$AllowCustomMemes,
    [bool]$AllowDeleteChannels,
    [bool]$AllowGiphy,
    [bool]$AllowGuestCreateUpdateChannels,
    [bool]$AllowGuestDeleteChannels,
    [bool]$AllowOwnerDeleteMessages,
    [bool]$AllowStickersAndMemes,
    [bool]$AllowTeamMentions,
    [bool]$AllowUserDeleteMessages,
    [bool]$AllowUserEditMessages,
    [ValidateSet('Strict', 'Moderate')]
    [string]$GiphyContentRating,
    [bool]$ShowInTeamsSearchAndSuggestions
)

Process {
    try {
        [string[]]$Properties = @('DisplayName', 'GroupId')
        [hashtable]$cmdArgs = @{'ErrorAction' = 'Stop'; 'GroupId' = $GroupId}

        if (-not [System.String]::IsNullOrWhiteSpace($DisplayName)) {
            $cmdArgs.Add('DisplayName', $DisplayName)
        }
        if (-not [System.String]::IsNullOrWhiteSpace($Description)) {
            $cmdArgs.Add('Description', $Description)
            $Properties += 'Description'
        }
        if (-not [System.String]::IsNullOrWhiteSpace($MailNickName)) {
            $cmdArgs.Add('MailNickName', $MailNickName)
            $Properties += 'MailNickName'
        }
        if (-not [System.String]::IsNullOrWhiteSpace($Visibility)) {
            $cmdArgs.Add('Visibility', $Visibility)
            $Properties += 'Visibility'
        }
        if (-not [System.String]::IsNullOrWhiteSpace($GiphyContentRating)) {
            $cmdArgs.Add('GiphyContentRating', $GiphyContentRating)
            $Properties += 'GiphyContentRating'
        }

        $boolParams = @('AllowAddRemoveApps', 'AllowChannelMentions', 'AllowCreateUpdateChannels', 'AllowCreateUpdateRemoveConnectors', 'AllowCreateUpdateRemoveTabs', 'AllowCustomMemes', 'AllowDeleteChannels', 'AllowGiphy', 'AllowGuestCreateUpdateChannels', 'AllowGuestDeleteChannels', 'AllowOwnerDeleteMessages', 'AllowStickersAndMemes', 'AllowTeamMentions', 'AllowUserDeleteMessages', 'AllowUserEditMessages', 'ShowInTeamsSearchAndSuggestions')
        foreach ($paramName in $boolParams) {
            if ($PSBoundParameters.ContainsKey($paramName)) {
                $cmdArgs.Add($paramName, (Get-Variable -Name $paramName -ValueOnly))
            }
        }

        $result = Set-Team @cmdArgs | Select-Object $Properties

        if ($null -eq $result) {
            Write-Output "Team properties updated"
            return
        }
        $result | Add-Member -NotePropertyName Timestamp -NotePropertyValue (Get-Date -Format 'yyyy-MM-dd HH:mm:ss') -PassThru -Force
    }
    catch { throw }
}

GroupId of the team

Team display name

Team description

Alias for the associated Office 365 Group

Set to Public or Private

Members can add apps to the team

Channels can be @ mentioned

Members can create channels

Members can manage connectors

Members can manage tabs in channels

Members can use custom memes

Members can delete channels

Giphy can be used in the team

Guests can create channels

Guests can delete channels

Owners can delete any messages

Stickers and memes usage is allowed

The entire team can be @ mentioned

Members can delete their own messages

Users can edit their messages

Sensitivity level of giphy usage

Private teams are searchable from Teams clients

An interactive directory of PowerShell scripts.