On our tenant, how to get a list of all MS Teams with associated channels, e.g., in a CSV file?

frob 4,216 Reputation points
2022-11-04T00:10:22.63+00:00

Hi there

On our tenant, how to get a list of all MS Teams with associated channels, e.g., in a CSV file? If we can get owners of those Teams and Channels, that will be great!
Any PowerShell, API call or anything else?

(Teams Admin makes it very complicated to get this report, as we have to go to each team to get a channel list)

Thanks.

Microsoft Teams
Microsoft Teams
A Microsoft customizable chat-based workspace.
9,627 questions
Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,462 questions
0 comments No comments
{count} votes

Accepted answer
  1. SokiGuo-MSFT 25,751 Reputation points Microsoft Vendor
    2022-11-04T09:40:12.847+00:00

    Hi @frob

    Thanks for visiting our forum. Our forum focuses on Microsoft Teams, which is the hub for team collaboration in Office 365. Based on your description, this problem is related to Teams script

    development, which we do not support. The following suggestion only for your reference.

    I have found a script about how to get a list of all Teams with associated channels.

    # Connect to Microsoft Teams  
       
    Connect-MicrosoftTeams  
       
    # List all Teams and all Channels  
       
    $ErrorActionPreference = "SilentlyContinue"  
       
    $allteams = Get-Team  
    $object = @()  
       
    foreach ($t in $allteams) {  
       
        $members = Get-TeamUser -GroupId $t.GroupId  
       
        $owner = Get-TeamUser -GroupId $t.GroupId -Role Owner  
       
        $channels = Get-TeamChannel -GroupId $t.GroupId   
       
        $object += New-Object -TypeName PSObject -Property ([ordered]@{  
       
            'Team'= $t.DisplayName  
            'GroupId' = $t.GroupId  
            'Owner' = $owner.User  
            'Members' = $members.user -join "`r`n"  
            'Channels' = $channels.displayname -join "`r`n"  
           
            })  
               
    }  
    Write-Output $object  
    

    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.



0 additional answers

Sort by: Most helpful