public/Get-SkylineCustomAction.ps1
Function Get-SkylineCustomAction { <# .SYNOPSIS Gets all site and web scoped custom actions .DESCRIPTION Gets all site and web scoped custom actions .EXAMPLE Get-SkylineCustomAction .EXAMPLE Get-SkylineCustomAction -Name "SiteOrWebCustomAction" .EXAMPLE Get-SkylineCustomAction -Web $Subweb .PARAMETER Name Name of the custom action to get, can be site or web scoped .PARAMETER Web The web to apply the command to. Omit this parameter to use the current web. #> [cmdletbinding()] param( [string]$Name = '', [Microsoft.SharePoint.Client.Web]$Web ) Process { Write-Debug ( "Running $($MyInvocation.MyCommand).`n" + "PSBoundParameters:`n$($PSBoundParameters | Format-List | Out-String)") Try { $PSBoundParameters.Remove("Name") | Out-Null $WebCustomActions = @( Get-PnPCustomAction -Scope Web @PSBoundParameters ) $SiteCustomActions = @( Get-PnPCustomAction -Scope Site @PSBoundParameters ) $Combined = @($WebCustomActions + $SiteCustomActions) if ($Name) { return $Combined | Where-Object {$_.Name -eq $Name} } else { return $Combined } } Catch { Throw $_ } } } |