Skip to main content

Remove Wiki tab in a Microsoft Teams channel

Inspired by: Garry Trinder and Laura Kokkarinen

Removes the wiki tab of a Microsoft Teams Team's channel.

$groupMailNickname = "Architecture"
$channelName = "General"

$groups = m365 entra m365group list --query "[?mailNickname=='$groupMailNickname']" -o json | ConvertFrom-Json
if ($null -eq $groups) { Write-Error "A team with the mailNickname $groupMailNickname was not found" }
else {
$channels = m365 teams channel list --teamId $groups[0].id --query "[?displayName=='$channelName']" -o json | ConvertFrom-Json
if ($null -eq $channels) { Write-Error "A channel with the name $channelName was not found in the team" }
else {
$tabs = m365 teams tab list --teamId $groups[0].id --channelId $channels[0].id --query "[?teamsApp.id=='com.microsoft.teamspace.tab.wiki']" -o json | ConvertFrom-Json
if ($null -eq $tabs) { Write-Error "A Wiki tab was not found in the channel" }
else {
write-host "Removing wiki tab for the channel.." -ForegroundColor Green
m365 teams tab remove --teamId $groups[0].id --channelId $channels[0].id --id $tabs[0].id --force
write-host " ...Done" -ForegroundColor Green
}
}
}
CTRL + M