SOLVED

Teams Shared Channel PowerShell, Retrieve Members and Teams

Brass Contributor

I can retrieve the members of a shared channel via 

Get-TeamChannelUser -GroupId <> -DisplayName <>

However when sharing a shared channel there is the option to "share with a team" (which you could be the one you own etc)
I can't see a way to retrieve the list of "teams"

Advice welcome
Thanks
AlistairKeay_0-1692046700400.png

 



3 Replies
best response confirmed by AlistairKeay1 (Brass Contributor)
Solution

@AlistairKeay1 to retrieve the list of teams a for a shared channel, use the Get-SharedWithTeam command 

 

For example, 

Get-SharedWithTeam -HostTeamId id-of-the-team-that-created-the-shared-channel -ChannelId id-of-the-shared-channel

 

It will return the teams that shared channel is shared with

Carl_Karawani_0-1692066819071.png

 

Also, you can see all the Shared Channels that are shared with a specific team (the reverse lookup of what you are doing) via Get-TeamAllChannel cmlet 

 

Perfect _ thanks Karl
FYI what I am trying to do\why is as follows.
Tenant to tenant migration project. Till now shared channels are used from "Target" to "Source".
As we collapse down the source into target I want to make sure the source users, when they logon with their new target account continue to have access to the shared channels.
I have a working script (still in testing phase) which is roughly as follows
Get-UnifiedGroup #get all the teams groups. Get-Team too slow
Loop through each group and
$Channels = Get-TeamChannel -MembershipType Shared
Then loop through each channel and Get-TeamChannelUser
Then loop through each user and identify those users like “*@sourcedomain.com” etc
Map the new user identity to the old. Add-teamchanneluser of the new identity

I just need to work on how to handle the shared with a team logic.
(The source teams are being copied to target using ShareGate)
1 best response

Accepted Solutions
best response confirmed by AlistairKeay1 (Brass Contributor)
Solution

@AlistairKeay1 to retrieve the list of teams a for a shared channel, use the Get-SharedWithTeam command 

 

For example, 

Get-SharedWithTeam -HostTeamId id-of-the-team-that-created-the-shared-channel -ChannelId id-of-the-shared-channel

 

It will return the teams that shared channel is shared with

Carl_Karawani_0-1692066819071.png

 

Also, you can see all the Shared Channels that are shared with a specific team (the reverse lookup of what you are doing) via Get-TeamAllChannel cmlet 

 

View solution in original post