Aktualisiere Versionsnummern auf 1.0.3 in package.json, package-solution.json, Manifestdateien und verbessere README.md mit neuen Registrierungsanweisungen; entferne Test-ExpiryIndicatorRegistration.ps1.

This commit is contained in:
Torsten Brendgen
2026-07-17 00:01:56 +02:00
parent f574a749d1
commit 5e2086a1d8
9 changed files with 26 additions and 101 deletions

View File

@@ -209,8 +209,8 @@ Nach **Speichern** wird die Konfiguration pro Liste beziehungsweise Bibliothek i
### Anzeige aktivieren ### Anzeige aktivieren
Der Field Customizer und das Command Set werden einmal pro Liste beziehungsweise Bibliothek mit dem Der Field Customizer wird einmal pro Liste beziehungsweise Bibliothek mit dem mitgelieferten Skript
mitgelieferten Skript registriert: an der Ablaufdatumsspalte registriert:
```powershell ```powershell
.\scripts\Enable-ExpiryIndicator.ps1 ` .\scripts\Enable-ExpiryIndicator.ps1 `
@@ -220,8 +220,8 @@ mitgelieferten Skript registriert:
``` ```
Der Wert von `ExpiryFieldInternalName` muss mit **Internes Ablaufdatumsfeld** in den Einstellungen Der Wert von `ExpiryFieldInternalName` muss mit **Internes Ablaufdatumsfeld** in den Einstellungen
übereinstimmen. Das Skript registriert zugleich die Befehle **Expiry-Einstellungen** und übereinstimmen. Das Command Set wird durch die Installation der App registriert. Danach die Listenansicht
**Ablaufdatum +1 Jahr**. Danach die Listenansicht neu laden. neu laden.
### Ablaufdatum um ein Jahr verlängern ### Ablaufdatum um ein Jahr verlängern

View File

@@ -3,7 +3,7 @@
"solution": { "solution": {
"name": "expiry-indicator-client-side-solution", "name": "expiry-indicator-client-side-solution",
"id": "68bb6d2d-9895-45b4-88e8-b98835faa981", "id": "68bb6d2d-9895-45b4-88e8-b98835faa981",
"version": "1.0.1.0", "version": "1.0.3.0",
"includeClientSideAssets": true, "includeClientSideAssets": true,
"skipFeatureDeployment": false, "skipFeatureDeployment": false,
"features": [ "features": [
@@ -11,7 +11,7 @@
"title": "ExpiryIndicator command set registration", "title": "ExpiryIndicator command set registration",
"description": "Registers ExpiryIndicator commands for modern lists and document libraries. Does not provision ExpiryDate.", "description": "Registers ExpiryIndicator commands for modern lists and document libraries. Does not provision ExpiryDate.",
"id": "913402af-ab9a-4974-9f86-5c2159ae41db", "id": "913402af-ab9a-4974-9f86-5c2159ae41db",
"version": "1.0.1.0", "version": "1.0.3.0",
"assets": { "assets": {
"elementManifests": [ "elementManifests": [
"elements.xml" "elements.xml"

View File

@@ -1,6 +1,6 @@
{ {
"name": "expiry-indicator", "name": "expiry-indicator",
"version": "1.0.1", "version": "1.0.3",
"private": true, "private": true,
"engines": { "engines": {
"node": ">=6.9.0 <9.0.0" "node": ">=6.9.0 <9.0.0"

View File

@@ -9,9 +9,7 @@ param(
[Parameter(Mandatory = $true)] [Parameter(Mandatory = $true)]
[string]$ExpiryFieldInternalName, [string]$ExpiryFieldInternalName,
[Guid]$FieldCustomizerComponentId = 'a555f4fc-d6a6-4421-8189-457449d9bbde', [Guid]$FieldCustomizerComponentId = 'a555f4fc-d6a6-4421-8189-457449d9bbde'
[Guid]$CommandSetComponentId = 'cd58f5d9-ffc8-4df7-a910-3054842d7abf'
) )
$isapiPath = Join-Path ([Environment]::GetFolderPath('CommonProgramFiles')) 'microsoft shared\Web Server Extensions\16\ISAPI' $isapiPath = Join-Path ([Environment]::GetFolderPath('CommonProgramFiles')) 'microsoft shared\Web Server Extensions\16\ISAPI'
@@ -24,28 +22,20 @@ $context.Credentials = [System.Net.CredentialCache]::DefaultNetworkCredentials
try { try {
$list = $context.Web.Lists.GetByTitle($ListTitle) $list = $context.Web.Lists.GetByTitle($ListTitle)
$field = $list.Fields.GetByInternalNameOrTitle($ExpiryFieldInternalName) $field = $list.Fields.GetByInternalNameOrTitle($ExpiryFieldInternalName)
$customActions = $list.UserCustomActions
$context.Load($list) $context.Load($list)
$context.Load($field) $context.Load($field)
$context.Load($customActions)
$context.ExecuteQuery() $context.ExecuteQuery()
if ($PSCmdlet.ShouldProcess("$($list.Title)/$($field.InternalName)", 'ExpiryIndicator-Registrierungen entfernen')) { if ($field.ClientSideComponentId -ne $FieldCustomizerComponentId) {
if ($field.ClientSideComponentId -eq $FieldCustomizerComponentId) { throw "Das Feld '$($field.InternalName)' ist nicht mit dem erwarteten ExpiryIndicator-Field-Customizer verbunden."
}
if ($PSCmdlet.ShouldProcess("$($list.Title)/$($field.InternalName)", 'Field-Customizer-Verknüpfung entfernen')) {
$field.ClientSideComponentId = [Guid]::Empty $field.ClientSideComponentId = [Guid]::Empty
$field.ClientSideComponentProperties = '' $field.ClientSideComponentProperties = ''
$field.Update() $field.Update()
}
$customActions | Where-Object {
$_.Name -eq 'ExpiryIndicator.CommandSet' -or
$_.ClientSideComponentId -eq $CommandSetComponentId
} | ForEach-Object {
$_.DeleteObject()
}
$context.ExecuteQuery() $context.ExecuteQuery()
Write-Host 'ExpiryIndicator-Registrierungen wurden entfernt. Feld und Daten bleiben unverändert.' Write-Host 'ExpiryIndicator-Verknüpfung wurde entfernt. Feld und Daten bleiben unverändert.'
} }
} }
finally { finally {

View File

@@ -9,9 +9,7 @@ param(
[Parameter(Mandatory = $true)] [Parameter(Mandatory = $true)]
[string]$ExpiryFieldInternalName, [string]$ExpiryFieldInternalName,
[Guid]$FieldCustomizerComponentId = 'a555f4fc-d6a6-4421-8189-457449d9bbde', [Guid]$FieldCustomizerComponentId = 'a555f4fc-d6a6-4421-8189-457449d9bbde'
[Guid]$CommandSetComponentId = 'cd58f5d9-ffc8-4df7-a910-3054842d7abf'
) )
$isapiPath = Join-Path ([Environment]::GetFolderPath('CommonProgramFiles')) 'microsoft shared\Web Server Extensions\16\ISAPI' $isapiPath = Join-Path ([Environment]::GetFolderPath('CommonProgramFiles')) 'microsoft shared\Web Server Extensions\16\ISAPI'
@@ -38,27 +36,17 @@ try {
$field.ClientSideComponentProperties = '{}' $field.ClientSideComponentProperties = '{}'
$field.Update() $field.Update()
$commandAction = $customActions | Where-Object { # Remove the temporary list-scoped command registration used by older
$_.Name -eq 'ExpiryIndicator.CommandSet' -or # diagnostic scripts. The app feature owns the production registration.
$_.ClientSideComponentId -eq $CommandSetComponentId $customActions | Where-Object {
} | Select-Object -First 1 $_.Name -eq 'ExpiryIndicator.CommandSet'
} | ForEach-Object {
if ($null -eq $commandAction) { $_.DeleteObject()
$commandAction = $customActions.Add()
} }
$commandAction.Name = 'ExpiryIndicator.CommandSet'
$commandAction.Title = 'ExpiryIndicator commands'
$commandAction.Location = 'ClientSideExtension.ListViewCommandSet.CommandBar'
$commandAction.ClientSideComponentId = $CommandSetComponentId
$commandAction.ClientSideComponentProperties = '{}'
$commandAction.Update()
$context.ExecuteQuery() $context.ExecuteQuery()
Write-Host "Field Customizer wurde an '$($field.InternalName)' gebunden." Write-Host "ExpiryIndicator wurde für '$($list.Title)' an '$($field.InternalName)' gebunden."
Write-Host "Command Set wurde an '$($list.Title)' registriert."
Write-Host 'Bitte die moderne Listenansicht mit Strg+F5 neu laden.'
} }
finally { finally {
$context.Dispose() $context.Dispose()

View File

@@ -1,50 +0,0 @@
[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()
}

View File

@@ -3,7 +3,6 @@
<!-- ExpiryDate is intentionally not provisioned. It is supplied by the Content Type Hub. --> <!-- ExpiryDate is intentionally not provisioned. It is supplied by the Content Type Hub. -->
<CustomAction <CustomAction
Title="ExpiryIndicator commands for lists" Title="ExpiryIndicator commands for lists"
Name="ExpiryIndicator.CommandSet.Lists"
RegistrationId="100" RegistrationId="100"
RegistrationType="List" RegistrationType="List"
Location="ClientSideExtension.ListViewCommandSet.CommandBar" Location="ClientSideExtension.ListViewCommandSet.CommandBar"
@@ -11,11 +10,9 @@
ClientSideComponentProperties="{}" /> ClientSideComponentProperties="{}" />
<CustomAction <CustomAction
Title="ExpiryIndicator commands for document libraries" Title="ExpiryIndicator commands for document libraries"
Name="ExpiryIndicator.CommandSet.Libraries"
RegistrationId="101" RegistrationId="101"
RegistrationType="List" RegistrationType="List"
Location="ClientSideExtension.ListViewCommandSet.CommandBar" Location="ClientSideExtension.ListViewCommandSet.CommandBar"
ClientSideComponentId="cd58f5d9-ffc8-4df7-a910-3054842d7abf" ClientSideComponentId="cd58f5d9-ffc8-4df7-a910-3054842d7abf"
ClientSideComponentProperties="{}" /> ClientSideComponentProperties="{}" />
</Elements> </Elements>

View File

@@ -4,7 +4,7 @@
"alias": "ExpiryIndicatorFieldCustomizer", "alias": "ExpiryIndicatorFieldCustomizer",
"componentType": "Extension", "componentType": "Extension",
"extensionType": "FieldCustomizer", "extensionType": "FieldCustomizer",
"version": "1.0.1", "version": "1.0.3",
"manifestVersion": 2, "manifestVersion": 2,
"requiresCustomScript": false "requiresCustomScript": false
} }

View File

@@ -4,7 +4,7 @@
"alias": "ExpiryIndicatorCommandSet", "alias": "ExpiryIndicatorCommandSet",
"componentType": "Extension", "componentType": "Extension",
"extensionType": "ListViewCommandSet", "extensionType": "ListViewCommandSet",
"version": "1.0.1", "version": "1.0.3",
"manifestVersion": 2, "manifestVersion": 2,
"requiresCustomScript": false, "requiresCustomScript": false,
"items": { "items": {