Get-MgmtGraphTeamChannel
MgmtGraph: Audits Microsoft Team channels
#Requires -Version 5.1
#Requires -Modules Microsoft.Graph.Teams
[CmdletBinding()]
Param (
[Parameter(Mandatory = $true, Position = 0)]
[string]$Identity,
[string]$ChannelId
)
Process {
try {
$params = @{
'TeamId' = $Identity
'ErrorAction' = 'Stop'
}
if ($ChannelId) {
$params.Add('ChannelId', $ChannelId)
}
else {
$params.Add('All', $true)
}
$channels = Get-MgTeamChannel @params
$results = foreach ($c in $channels) {
[PSCustomObject]@{
DisplayName = $c.DisplayName
Id = $c.Id
Description = $c.Description
MembershipType = $c.MembershipType
CreatedDateTime = $c.CreatedDateTime
WebUrl = $c.WebUrl
Timestamp = Get-Date -Format "yyyy-MM-dd HH:mm:ss"
}
}
Write-Output ($results | Sort-Object DisplayName)
}
catch {
throw
}
}Specifies the ID of the Team to audit.
Optional. Specifies the ID of a specific channel to retrieve. If omitted, all channels in the Team are listed.