Files
ExpiryIndicator/scripts/Test-ExpiryIndicatorRegistration.ps1

52 lines
1.6 KiB
PowerShell

[CmdletBinding()]
param(
[Parameter(Mandatory = $true)]
[string]$SiteUrl,
[Parameter(Mandatory = $true)]
[string]$ListTitle,
[Parameter(Mandatory = $true)]
[string]$ExpiryFieldInternalName
)
$isapiPath = Join-Path ([Environment]::GetFolderPath('CommonProgramFiles')) 'microsoft shared\Web Server Extensions\16\ISAPI'
Add-Type -Path (Join-Path $isapiPath 'Microsoft.SharePoint.Client.Runtime.dll')
Add-Type -Path (Join-Path $isapiPath 'Microsoft.SharePoint.Client.dll')
$context = New-Object Microsoft.SharePoint.Client.ClientContext($SiteUrl)
$context.Credentials = [System.Net.CredentialCache]::DefaultNetworkCredentials
try {
$list = $context.Web.Lists.GetByTitle($ListTitle)
$field = $list.Fields.GetByInternalNameOrTitle($ExpiryFieldInternalName)
$customActions = $list.UserCustomActions
$context.Load($list)
$context.Load($field)
$context.Load($customActions)
$context.ExecuteQuery()
Write-Host "Liste: $($list.Title)"
Write-Host "Feld: $($field.InternalName)"
Write-Host "Field Customizer: $($field.ClientSideComponentId)"
Write-Host ''
Write-Host 'List User Custom Actions:'
$actions = @($customActions | Where-Object {
$_.Location -eq 'CommandUI.Ribbon' -or
$_.Location -like 'ClientSideExtension.ListViewCommandSet*' -or
$_.Name -like 'ExpiryIndicator*'
})
if ($actions.Count -eq 0) {
Write-Warning 'Kein ExpiryIndicator Command Set an der Liste registriert.'
}
else {
$actions | Select-Object Name, Title, Location, ClientSideComponentId, ClientSideComponentProperties |
Format-List
}
}
finally {
$context.Dispose()
}