functions/inbox/Get-TssInboxTemplate.ps1
|
function Get-TssInboxTemplate { <# .SYNOPSIS Get an inbox notification template .DESCRIPTION Gets one or more inbox notification templates by ID. Locale is the locale culture ID of the template's default locale. Pass it with the template ID to Get-TssInboxTemplateLocale to read the subject and body. .PARAMETER TssSession TssSession object created by New-TssSession for authentication .PARAMETER Id Inbox template ID .EXAMPLE $session = New-TssSession -SecretServer https://alpha -Credential $ssCred Get-TssInboxTemplate -TssSession $session -Id 4 Get inbox template 4 .EXAMPLE $session = New-TssSession -SecretServer https://alpha -Credential $ssCred Get-TssInboxTemplate -TssSession $session -Id 4 | Get-TssInboxTemplateLocale -TssSession $session Get the subject and body of the default locale of inbox template 4 .LINK https://thycotic-ps.github.io/thycotic.secretserver/commands/inbox/Get-TssInboxTemplate .LINK https://github.com/thycotic-ps/thycotic.secretserver/blob/main/src/functions/inbox/Get-TssInboxTemplate.ps1 .NOTES Requires TssSession object returned by New-TssSession #> [CmdletBinding()] [OutputType('Thycotic.PowerShell.Inbox.Template')] param ( [Parameter(Mandatory, ValueFromPipeline, Position = 0)] [Thycotic.PowerShell.Authentication.Session] $TssSession, [Parameter(Mandatory, ValueFromPipelineByPropertyName)] [Alias('TemplateId')] [int[]] $Id ) begin { $tssParams = $PSBoundParameters $invokeParams = . $GetInvokeApiParams $TssSession } process { Get-TssInvocation $PSCmdlet.MyInvocation if ($tssParams.ContainsKey('TssSession') -and $TssSession.IsValidSession()) { Compare-TssVersion $TssSession '10.9.000000' $PSCmdlet.MyInvocation foreach ($currentId in $Id) { $restResponse = $null $uri = $TssSession.ApiUrl, 'inbox', 'templates', $currentId -join '/' $invokeParams.Uri = $uri $invokeParams.Method = 'GET' Write-Verbose "Performing the operation $($invokeParams.Method) $uri" try { $apiResponse = Invoke-TssApi @invokeParams $restResponse = . $ProcessResponse $apiResponse } catch { Write-Warning 'Issue with Get-TssInboxTemplate request' $err = $_ . $ErrorHandling $err } if ($restResponse) { [Thycotic.PowerShell.Inbox.Template](. $FilterTssResponse $restResponse ([Thycotic.PowerShell.Inbox.Template])) } } } else { Write-Warning 'No valid session found' } } } |