adding users to channels

Rising Flight 4,196 Reputation points
2024-07-05T22:50:34.0366667+00:00

Hi All

I have a unified group it has a teams and this teams has 5 channels(General/C1/C2/C3/C4). i have a list of users to be added to the channel. For example in general channel i want to add 200 users. For C1 500 users/ C2-300 users/C3-100 users/C4-50 users). please guide me how to add users to the channel. is it possible to add users to the channel from powershell by import csv file. my csv file is in below format.

EmailAddress 
user1@contoso.com  
user2@contoso.com

Microsoft Exchange Online
Microsoft Teams
Microsoft Teams
A Microsoft customizable chat-based workspace.
9,515 questions
Microsoft Exchange Online Management
Microsoft Exchange Online Management
Microsoft Exchange Online: A Microsoft email and calendaring hosted service.Management: The act or process of organizing, handling, directing or controlling something.
4,350 questions
Microsoft Exchange Hybrid Management
Microsoft Exchange Hybrid Management
Microsoft Exchange: Microsoft messaging and collaboration software.Hybrid Management: Organizing, handling, directing or controlling hybrid deployments.
1,981 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. LiweiTian-MSFT 16,450 Reputation points Microsoft Vendor
    2024-07-08T02:15:17.19+00:00

    Hi @Rising Flight

    Use the Add-TeamChannelUser cmdlet, or the corresponding Graph API endpoint: https://video2.skills-academy.com/en-us/powershell/module/teams/add-teamchanneluser?view=teams-ps Here's a quick example on how to bulk add via CSV:

    Copy

    Import-Csv "blabla.csv” | % {Add-TeamChannelUser -GroupId GUID -DisplayName "channel name" -User $_.UPN}  
    

    where the CSV has a column called "UPN" to designate the users


    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 comments No comments

  2. Rising Flight 4,196 Reputation points
    2024-07-08T05:27:59.4933333+00:00

    I am getting below error.

    Add-TeamChannelUser : Cannot bind argument to parameter 'User' because it is null.

    Add-TeamChannelUser : Error occurred while executing Add-TeamChannelUser

    Code: BadRequest

    Message: Invalid User Id.

    i have used my csv files in the below 4 formats
    
    EmailAddress
    user1@contoso.com
    
    EmailAddress
    user1
    
    UPN
    user1@contoso.com
    
    UPN
    user1
    
    i have used the below syntaxes but stil i am getting error.
    
    Import-Csv "C:\temp\input.csv" | % {Add-TeamChannelUser -GroupId 111111-1111-1111-111-1111111 -DisplayName "test1" -User $_.UPN}
    
    
    Import-Csv "C:\temp\input.csv" | % {Add-TeamChannelUser -GroupId 111111-1111-1111-111-1111111 -DisplayName "test1" -User $_.EmailAddress}
    
    
    

    InnerError:

    0 comments No comments