New-MSTTeamByGroupId
Teams: Creates a new Team from existing O365 Unified Group
#Requires -Version 5.1
[CmdletBinding()]
Param(
[Parameter(Mandatory = $true)]
[string]$GroupId,
[bool]$AllowAddRemoveApps,
[bool]$AllowChannelMentions,
[bool]$AllowCreateUpdateChannels,
[bool]$AllowCreateUpdateRemoveConnectors,
[bool]$AllowCreateUpdateRemoveTabs,
[bool]$AllowCustomMemes,
[bool]$AllowDeleteChannels,
[bool]$AllowGuestCreateUpdateChannels,
[bool]$AllowGiphy,
[bool]$AllowGuestDeleteChannels,
[bool]$AllowOwnerDeleteMessages,
[bool]$AllowStickersAndMemes,
[bool]$AllowTeamMentions,
[bool]$AllowUserDeleteMessages,
[bool]$AllowUserEditMessages,
[bool]$ShowInTeamsSearchAndSuggestions,
[ValidateSet('Strict', 'Moderate')]
[string]$GiphyContentRating,
[string]$Owner
)
Process {
try {
[string[]]$Properties = @('DisplayName', 'GroupId')
[hashtable]$cmdArgs = @{'ErrorAction' = 'Stop'; 'GroupId' = $GroupId}
if (-not [System.String]::IsNullOrWhiteSpace($GiphyContentRating)) {
$cmdArgs.Add('GiphyContentRating', $GiphyContentRating)
$Properties += 'GiphyContentRating'
}
if (-not [System.String]::IsNullOrWhiteSpace($Owner)) {
$cmdArgs.Add('Owner', $Owner)
$Properties += 'Owner'
}
$boolParams = @('AllowAddRemoveApps', 'AllowChannelMentions', 'AllowCreateUpdateChannels', 'AllowCreateUpdateRemoveConnectors', 'AllowCreateUpdateRemoveTabs', 'AllowCustomMemes', 'AllowDeleteChannels', 'AllowGuestCreateUpdateChannels', 'AllowGiphy', 'AllowGuestDeleteChannels', 'AllowOwnerDeleteMessages', 'AllowStickersAndMemes', 'AllowTeamMentions', 'AllowUserDeleteMessages', 'AllowUserEditMessages', 'ShowInTeamsSearchAndSuggestions')
foreach ($paramName in $boolParams) {
if ($PSBoundParameters.ContainsKey($paramName)) {
$cmdArgs.Add($paramName, (Get-Variable -Name $paramName -ValueOnly))
}
}
$result = New-Team @cmdArgs | Select-Object $Properties
if ($null -eq $result) {
Write-Output "Failed to create team from group"
return
}
$result | Add-Member -NotePropertyName Timestamp -NotePropertyValue (Get-Date -Format 'yyyy-MM-dd HH:mm:ss') -PassThru -Force
}
catch { throw }
}Specify a GroupId to convert to a Team
Members can add apps to the team
Channels can be @ mentioned
Members can create channels
Members can manage connectors
Members can manage tabs in channels
Members can use custom memes
Members can delete channels
Guests can create channels
Giphy can be used in the team
Guests can delete channels
Owners can delete any messages
Stickers and memes usage is allowed
The entire team can be @ mentioned
Members can delete their own messages
Users can edit their messages
Private teams are searchable from Teams clients
Sensitivity level of giphy usage
Desired owner of the team