Skip to content

Get-MSTTeamTemplate

Teams: Get team template details

#Requires -Version 5.1

[CmdletBinding()]
Param(
    [Parameter(Mandatory = $true, ParameterSetName = 'ById')]
    [string]$ODataId,
    [Parameter(Mandatory = $true, ParameterSetName = 'ByName')]
    [string]$Name
)

Process {
    try {
        if ($PSCmdlet.ParameterSetName -eq 'ById') {
            $result = Get-CsTeamTemplate -OdataId $ODataId -ErrorAction Stop | Select-Object *
        }
        else {
            $result = (Get-CsTeamTemplateList -ErrorAction Stop) | Where-Object Name -eq $Name | ForEach-Object { Get-CsTeamTemplate -OdataId $_.OdataId -ErrorAction Stop } | Select-Object *
        }

        if ($null -eq $result -or $result.Count -eq 0) {
            Write-Output "No team template found"
            return
        }
        foreach ($item in $result) {
            $item | Add-Member -NotePropertyName Timestamp -NotePropertyValue (Get-Date -Format 'yyyy-MM-dd HH:mm:ss') -PassThru -Force
        }
    }
    catch { throw }
}

A composite URI of a template

Name of the template to look up

An interactive directory of PowerShell scripts.