Remove Wiki tab in a Microsoft Teams channel
Summary
Removes the wiki tab of a Microsoft Teams Team's channel.
Warning
Please be aware this script contains a command that will remove or delete an artifact, ensure you test and understand the implications of running the script.
$groupMailNickname = "Architecture"
$channelName = "General"
$groups = m365 aad o365group 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 --tabId $tabs[0].id --confirm
write-host " ...Done" -ForegroundColor Green
}
}
}
Check out the CLI for Microsoft 365 to learn more at: https://aka.ms/cli-m365
Source Credit
Sample first appeared on Remove Wiki tab in a Microsoft Teams channel | CLI for Microsoft 365
Contributors
Author(s) |
---|
Garry Trinder |
Laura Kokkarinen |
Rabia Williams |
Disclaimer
THESE SAMPLES ARE PROVIDED AS IS WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.