Skip to content

Get-MSTTeamChannel

Teams: Get all channels for a team

#Requires -Version 5.1

[CmdletBinding()]
Param(
    [Parameter(Mandatory = $true)]
    [string]$GroupId
)

Process {
    try {
        [hashtable]$cmdArgs = @{'ErrorAction' = 'Stop'; 'GroupId' = $GroupId}

        $result = Get-TeamChannel @cmdArgs | Select-Object *

        if ($null -eq $result -or $result.Count -eq 0) {
            Write-Output "No team channels found"
            return
        }
        foreach ($item in $result) {
            $item | Add-Member -NotePropertyName Timestamp -NotePropertyValue (Get-Date -Format 'yyyy-MM-dd HH:mm:ss') -PassThru -Force
        }
    }
    catch { throw }
}

GroupId of the team

An interactive directory of PowerShell scripts.