0
votes

I have a CVS list that contains 3 columns, one of has the header Fullname.

I want to create teams with display name fullname

Then I want to copy the group ID from that new team to a variable to add a User as a owner.

foreach($team in $list)
{
    New-Team -displayname $team.Fullname -Template "EDU_class"

    $GroupID = get-team -DisplayName $team.Fullname | Select-Object GroupID

}

When I run my code, $GroupID is empty. Fullname has some space like : ABC-School Name-Classe Number-Year

I presume that's the problem ... If I run :

get-team -DisplayName "ABC-School Name-Classe Number-Year" | Select-Object GroupID

It Works, so How to deal with ?

1
If you only run Get-Team after it's been created is there any output? It takes some time for the Teams API to create a new Team as it has to create the Team, SP site, etc. I had an instance in the past where I had to script a do/until loop with a 1sec sleep that ran until Get-Team yielded a result. This insured the rest of my commands ran successfully.alexzelaya

1 Answers

0
votes

Thank you, I added 10 seconds and it helps !