Jump to content

Recommended Posts

Posted

Does anyone have any example PowerShell for creating Teams using the educationStaff template (which corresponds to that big "Staff" button you see in Teams when you click "Create Team")?

 

The official Teams cmdlets only do Class teams or PLC teams.

 

It looks like you have to do it via an API request (see https://docs.microsoft.com/en-gb/graph/api/team-post?view=graph-rest-beta) but I can't quite figure out how to actually do the request in PowerShell.

 

I found this Microsoft forum post which says to use

Invoke-RestMethod

but it doesn't say how you get the

$accesstoken

they mention:

 

https://techcommunity.microsoft.com/t5/teams-developer/create-teams-with-rest-api-failing/m-p/481157#

 

Can anyone shed any light on this?

Posted
https://www.thelazyadministrator.com/2019/07/22/connect-and-navigate-the-microsoft-graph-api-with-powershell/ goes into detail about how to get an access token for accessing the graph via PowerShell.

 

Turns out there's a much easier way, although slightly less automated as it requires interactive sign-in:

 

Import-Module SharePointPnPPowerShellOnline 3>$null
Write-Host "On the next step you'll be prompted to sign in"
Connect-PnPOnline -Scopes "Group.ReadWrite.All"
$accesstoken = Get-PnPAccessToken

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...