Home

Creation of Teams by PowerShell

Alberto Andrés Rodríguez
Occasional Contributor

Hi all!,

 

I've been struggling a little by creating Teams by PowerShell and I found something weird. I've been executing the following PS:

#se debe de tener en cuenta que el usuario que qcrea el grupo es el owner del mismo
$alias = "NuevoTest"
$DisplayName = "NuevoTest"
$visibilidad = "private" #por defecto es public
$owner = "user@domain.com"
$usuarios = @("user1@domain.com","user2@domian.com")


$group = New-Team -alias $alias -displayname $displayname -Visibility $visibilidad
add-teamuser -groupid $group.id -user $owner -role Owner
foreach ($user in $usuarios){
Add-TeamUser -GroupId $group.GroupId -User $user
}
#Add Channels to the Team
New-TeamChannel -GroupId $group.GroupId -DisplayName "1 Adoption" -Verbose
New-TeamChannel -GroupId $group.GroupId -DisplayName "2 Deployment" -Verbose
New-TeamChannel -GroupId $group.GroupId -DisplayName "3 Operations" -Verbose
New-TeamChannel -GroupId $group.GroupId -DisplayName "4 Change Management" -Verbose
Set-TeamFunSettings -GroupId $group.GroupId -AllowCustomMemes true -Verbose
Set-TeamMemberSettings -GroupId $group.GroupId -AllowCreateUpdateChannels false -AllowDeleteChannels false

Which allows me to create a new Team with their channels without problem, the weird thing is it in the Document Library in SPO. I know that everything is connected, so I have my Teams and by default I have the SC in SPO which points to Shared Documents, every channel created in Teams, will be created in SPO, but not in my case, I found that I am able to create all the channels that I want in PowerShell, this channels are listed in Teams, but by default are not listed in SPO.

 

I need to access to every channel, access to every files tab to get the folder channel created in SPO. I know that could be a by default behaviour, but I want to automatize the process, and get the folder in SPO without the need of access to the channel in Teams.

 

Has anyone faced this need? Is it possible to bypass this behaviour by using CSOM?

Thanks in advance

 

4 Replies

As with most Groups/Teams related tasks, it's a matter of waiting for the different workloads to "catch up" with the changes you have made. Which sadly can take up to a day if the synchronous "signal" fails. But yes, if your priority is the SPO side of things, best use CSOM.

Well, I think it could be a problem in the cmdlets that remember are still in preview...Teams creation in PowerShell should work in the same way as using the UI

My Experience is the same as Vasil's and Juan's it can take a while i recreated the whole thing using flow and Powerapps :) and now it is fast 

Thanks for the answers, I will wait and I will check the status of the channels in order to verify if it create the folders into SPO.