Last active
May 19, 2024 21:05
-
-
Save tdannecy/443788404bee7f816482710a37f98af7 to your computer and use it in GitHub Desktop.
Imports a csv of Teams or gets all Teams, iterates through each one, then adds the Orchestry app and correct "Team Information" tab on the General channel.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Add-OrchestryTeamTabToGeneralChannel.ps1 | |
## tdannecy@gmail.com 2024-05-19 | |
## Imports a csv of Teams or gets all Teams, iterates through each one, then adds the Orchestry app and correct "Team Information" tab on the General channel. | |
## Requires Teams Administrator permissions in Entra ID/AAD, Powershell 7, Teams Preview Powershell module, and PnPPowershell module installed and configured in Entra ID/AAD. | |
## Teams Preview help from: https://chrishayward.co.uk/2020/08/24/microsoft-teams-installing-powershell-preview-beta-modules-manage-private-channels/ | |
## Environment setup and config commands. | |
Set-Executionpolicy Unrestricted | |
winget install --id Microsoft.Powershell --source winget | |
& 'C:\Program Files\PowerShell\7\pwsh.exe' | |
Install-module -name 'pnp.powershell' -RequiredVersion 2.4.0 | |
Install-Module -Name MicrosoftTeams -RequiredVersion 1.1.3-preview -AllowPrerelease | |
Import-Module -name 'Pnp.Powershell' -RequiredVersion 2.4.0 | |
Connect-PnPOnline -Interactive -url 'https://XXX-admin.sharepoint.com' | |
cd D:\ # To get around issue with apostrophe in my username | |
Import-Module -name 'MicrosoftTeams' -RequiredVersion 1.1.3-preview -AllowPrerelease | |
Connect-MicrosoftTeams | |
## Get the Orchestry App ID | |
$orchestryappid = (Get-TeamsApp -displayname 'Orchestry').Id | |
## Import all Teams or from a CSV. | |
$teams = Get-team | |
## CSV format | |
## TeamName, MailNickName | |
## KPI Task Force [EXT], KPITaskForceEXT | |
## IMP Shared Workspace [EXT], imp-shared-workspace-ext | |
#$teams = import-csv -path D:\teams1.csv | |
foreach ($team in $teams) { | |
$groupid = (Get-PnpTeamsTeam -Identity $team.MailNickName).GroupId | |
if ($groupid) { | |
Add-TeamsAppInstallation -appid $orchestryappid -teamid $groupid | |
Remove-PnPTeamsTab -team $groupid -channel 'General' -Identity 'Team Information' -force:$true -Erroraction SilentlyContinue | |
add-pnpteamstab -team $groupid -channel 'General' -DisplayName 'Team Information' -Type custom -TeamsAppId $orchestryappid -Contenturl "https://app.orchestry.com/tabs/team-information?tid=$($groupid)&siteinfo=true&owners=true&members=true" | |
} | |
else { | |
Write-Error 'Team not found: $($team.DisplayName)' | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment