Remove-MgmtGraphTeamChannel
MgmtGraph: Deletes a Microsoft Team channel
#Requires -Version 5.1
#Requires -Modules Microsoft.Graph.Teams
[CmdletBinding()]
Param (
[Parameter(Mandatory = $true, Position = 0)]
[string]$Identity,
[Parameter(Mandatory = $true)]
[string]$ChannelId
)
Process {
try {
$params = @{
'TeamId' = $Identity
'ChannelId' = $ChannelId
'Confirm' = $false
'ErrorAction' = 'Stop'
}
Remove-MgTeamChannel @params
$result = [PSCustomObject]@{
TeamId = $Identity
ChannelId = $ChannelId
Action = "ChannelRemoved"
Status = "Success"
Timestamp = Get-Date -Format "yyyy-MM-dd HH:mm:ss"
}
Write-Output $result
}
catch {
throw
}
}Specifies the ID of the Team.
Specifies the ID of the channel to remove.