Custom actions are not available in the Essentials solution.
Use the script below to retrieve Teams owner names in a JSON string without the “ ” around the names or [ ] around the object:
In PowerShell:
$AllTeams = Get-Team
$TeamList = @()
foreach ($Team in $AllTeams)
{
$TeamGUID = $Team.GroupId.ToString()
$TeamName = $Team.DisplayName
write-host $TeamName
$TeamUsers = Get-TeamUser -GroupId $TeamGUID
$TeamOwner = ($TeamUsers | Where-Object {$_.Role -eq ‘Owner’}).User
$TeamList = $TeamList + [PSCustomObject]@{
TeamName = $TeamName;
TeamObjectID = $TeamGUID;
TeamOwners = $TeamOwner -join ‘; ‘;
}
}
$TeamList | export-csv c:\temp\TeamsData.csv -NoTypeInformation
In a CoreView custom action:
{
"id": "f2fc9d6f-50b8-49da-ad5a-4976cbc8109a",
"title": "Get Teams Owner Names",
"lastModified": "2022-02-09T11:56:13.3080000Z",
"target": "Teams",
"tags": [],
"vars": [],
"params": [
{
"name": "DisplayName",
"type": "string",
"isDefault": true
},
{
"name": "Id",
"type": "string",
"isDefault": false
}
],
"columns": {
"Id": "",
"DisplayName": ""
},
"version": 4,
"statement": "param ([string]$DisplayName, [string]$Id)\r\n\r\n$Id = \"bb4cdde2-eb41-40da-8531-7f4fd7556682\"\n$json = (Get-TeamUser -GroupId $Id -Role Owner | Select -ExpandProperty Name | ConvertTo-Json) -replace '\"', '' #-replace \",\",\"<br>\"\n\n$cleanjson = $json.Trim([char]0x005B, [char]0x005D)\n\nreturn $cleanjson"
}