Custom actions are not available in the Essentials solution.
Use the scripts below to retrieve a list of all guests and external users in a specific Teams group.
In PowerShell:
param ([string]$Id)
$TeamsGuests = @{}
$OrgName = “@” + (Get-OrganizationConfig).Identity
$Team = (Get-UnifiedGroup -Identity $Id) #Populate the array with current group membership
Get-UnifiedGroupLinks -LinkType Member -Identity $Team.Alias | % { $User = $_.Name.tostring() #Handle guest users
if ($User -like "*#EXT#*") {
$GuestUPN = $User + $OrgName
$GuestUser = Get-AzureADUser -ObjectId $GuestUPN -ErrorAction SilentlyContinue #Handle specific case for user displaynames containing commas
$GuestDisplayName = $GuestUser.DisplayName -replace ",", ""
$TeamsGuests.Add($GuestDisplayName, $GuestUser.Mail)
}
}
$TeamsGuestsjson = ($TeamsGuests | ConvertTo-Json)
$TeamsGuestsjsonClean = $TeamsGuestsjson -replace ",", "<br>"
$TeamsGuestsjsonOut = $TeamsGuestsjsonClean.Trim([char]0x007B, [char]0x007D)
return $TeamsGuestsjsonOut
In a CoreView custom action:
{
"id": "48bb0938-af1d-42db-8cda-c5c7fc69526e",
"title": "Get Teams Guests",
"lastModified": "2022-02-09T12:06:34.3330000Z",
"target": "Teams",
"tags": [],
"vars": [],
"params": [
{
"name": "DisplayName",
"type": "string",
"isDefault": true
},
{
"name": "Id",
"type": "string",
"isDefault": false
}
],
"columns": {
"Id": "",
"DisplayName": ""
},
"version": 5,
"statement": "param ([string]$DisplayName, [string]$Id)\r\n\r\n$TeamsGuests = @{}\n$OrgName = “@”+ (Get-OrganizationConfig).Identity\n$Team = (Get-UnifiedGroup -Identity $Id)\n# Populate the array with current group membership\nGet-UnifiedGroupLinks -LinkType Member -Identity $Team.Alias | % {\n $User = $_.Name.tostring()\n # Handle guest users\n if ($User -like \"*#EXT#*\") {\n $GuestUPN = $User+$OrgName\n $GuestUser = Get-AzureADUser -ObjectId $GuestUPN -ErrorAction SilentlyContinue\n #Handle specific case for user displaynames containing commas\n $GuestDisplayName = $GuestUser.DisplayName -replace \",\",\"\"\n $TeamsGuests.Add($GuestDisplayName, $GuestUser.Mail)\n }\n}\n\n$TeamsGuestsjson = ($TeamsGuests | ConvertTo-Json) \n$TeamsGuestsjsonClean = $TeamsGuestsjson -replace \",\",\"<br>\" -replace \"\"\"\",\"\"\n\n$TeamsGuestsjsonOut = $TeamsGuestsjsonClean.Trim([char]0x007B, [char]0x007D)\n\nreturn $TeamsGuestsjsonOut"
}