Aktualisiere die README.md mit Anweisungen zur Registrierung des Field Customizers und Command Sets; füge neue Parameter für Command Set IDs in Enable- und Disable-ExpiryIndicator.ps1 hinzu; erstelle Test-ExpiryIndicatorRegistration.ps1 zur Überprüfung der Registrierung.
This commit is contained in:
50
scripts/Test-ExpiryIndicatorRegistration.ps1
Normal file
50
scripts/Test-ExpiryIndicatorRegistration.ps1
Normal file
@@ -0,0 +1,50 @@
|
||||
[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 -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()
|
||||
}
|
||||
Reference in New Issue
Block a user