FunctionsPublic/New-GraphTeamChannel.ps1
function New-GraphTeamChannel { param([psobject]$accessToken, [string]$groupID, [string]$channelName) # # Create new unified group # $sendBody = @{ "displayName" = "$($channelName)"; "description" = "$($channelName)" } | ConvertTo-Json $responseBody = Invoke-RestMethod ` -Uri "https://graph.microsoft.com/v1.0/teams/$($groupID)/channels" ` -Headers @{"Authorization" = "Bearer $($accessToken.AccessTokenCredential.GetNetworkCredential().password)"} ` -Body $sendBody ` -ContentType "application/json" ` -Method POST $jsonResponse = $responseBody | ConvertTo-JSON $createdTeamChannel = ConvertFrom-Json -InputObject $jsonResponse return $createdTeamChannel } |