feat: update version to 2.1.2 and enhance ExpiryIndicator functionality with new binding handling

This commit is contained in:
Torsten Brendgen
2026-07-18 23:48:40 +02:00
parent 69a96b90c5
commit d97dbf45aa
10 changed files with 71 additions and 18 deletions

View File

@@ -18,6 +18,23 @@ $isapiPath = Join-Path ([Environment]::GetFolderPath('CommonProgramFiles')) 'mic
Add-Type -Path (Join-Path $isapiPath 'Microsoft.SharePoint.Client.Runtime.dll')
Add-Type -Path (Join-Path $isapiPath 'Microsoft.SharePoint.Client.dll')
function Expand-ExpiryIndicatorBindings {
param([object]$Value)
if ($null -eq $Value) { return }
if ($Value -is [System.Array]) {
foreach ($item in $Value) {
Expand-ExpiryIndicatorBindings -Value $item
}
return
}
if ($Value.PSObject.Properties['webUrl'] -and
$Value.PSObject.Properties['listId'] -and
$Value.PSObject.Properties['fieldInternalName']) {
Write-Output $Value
}
}
$context = New-Object Microsoft.SharePoint.Client.ClientContext($SiteUrl)
$context.Credentials = [System.Net.CredentialCache]::DefaultNetworkCredentials
@@ -50,7 +67,8 @@ try {
$existingBindingsJson = [string]$rootWeb.AllProperties[$bindingsKey]
if (-not [string]::IsNullOrWhiteSpace($existingBindingsJson)) {
try {
$bindings = @($existingBindingsJson | ConvertFrom-Json)
$parsedBindings = $existingBindingsJson | ConvertFrom-Json
$bindings = @(Expand-ExpiryIndicatorBindings -Value $parsedBindings)
}
catch {
$bindings = @()

View File

@@ -20,6 +20,23 @@ $isapiPath = Join-Path ([Environment]::GetFolderPath('CommonProgramFiles')) 'mic
Add-Type -Path (Join-Path $isapiPath 'Microsoft.SharePoint.Client.Runtime.dll')
Add-Type -Path (Join-Path $isapiPath 'Microsoft.SharePoint.Client.dll')
function Expand-ExpiryIndicatorBindings {
param([object]$Value)
if ($null -eq $Value) { return }
if ($Value -is [System.Array]) {
foreach ($item in $Value) {
Expand-ExpiryIndicatorBindings -Value $item
}
return
}
if ($Value.PSObject.Properties['webUrl'] -and
$Value.PSObject.Properties['listId'] -and
$Value.PSObject.Properties['fieldInternalName']) {
Write-Output $Value
}
}
$context = New-Object Microsoft.SharePoint.Client.ClientContext($SiteUrl)
$context.Credentials = [System.Net.CredentialCache]::DefaultNetworkCredentials
@@ -58,7 +75,7 @@ try {
$rootWeb.AllProperties[$descriptorKey] = ([ordered]@{
key = 'ExpiryIndicator'
displayName = 'Expiry Indicator'
version = '2.1.1'
version = '2.1.2'
provider = 'expiryIndicator'
componentIds = @(
'a555f4fc-d6a6-4421-8189-457449d9bbde',
@@ -72,7 +89,8 @@ try {
$existingBindingsJson = [string]$rootWeb.AllProperties[$bindingsKey]
if (-not [string]::IsNullOrWhiteSpace($existingBindingsJson)) {
try {
$bindings = @($existingBindingsJson | ConvertFrom-Json)
$parsedBindings = $existingBindingsJson | ConvertFrom-Json
$bindings = @(Expand-ExpiryIndicatorBindings -Value $parsedBindings)
}
catch {
Write-Warning 'Das vorhandene ExpiryIndicator-Bindungsinventar war ungültig und wird neu aufgebaut.'
@@ -130,10 +148,10 @@ try {
$scriptAction.Update()
$ribbonLocation = if ($list.BaseType -eq [Microsoft.SharePoint.Client.BaseType]::DocumentLibrary) {
'Ribbon.Library.Actions.Controls._children'
'Ribbon.Documents.Manage.Controls._children'
}
else {
'Ribbon.List.Actions.Controls._children'
'Ribbon.ListItem.Actions.Controls._children'
}
$ribbonXml = @"