From 1ce184ecb2324798a837f727d0faebfdba7ec1dc Mon Sep 17 00:00:00 2001 From: Giacomo Pozzoni Date: Sun, 5 May 2024 22:21:47 +0200 Subject: [PATCH] Allow to pass empty values to Set-PnPTenantCdnPolicy Change Set-PnPTenantCdnPolicy to allow PolicyValue to be an empty string or $null, while still being mandatory. --- src/Commands/Admin/SetTenantCdnPolicy.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Commands/Admin/SetTenantCdnPolicy.cs b/src/Commands/Admin/SetTenantCdnPolicy.cs index ffdf5f210..777ccc243 100644 --- a/src/Commands/Admin/SetTenantCdnPolicy.cs +++ b/src/Commands/Admin/SetTenantCdnPolicy.cs @@ -14,11 +14,17 @@ public class SetTenantCdnPolicy : PnPAdminCmdlet [Parameter(Mandatory = true)] public SPOTenantCdnPolicyType PolicyType; + [AllowEmptyString] + [AllowNull] [Parameter(Mandatory = true)] public string PolicyValue; protected override void ExecuteCmdlet() { + // A null PolicyValue throws an exception Microsoft.SharePoint.Client.UnknownError + if (PolicyValue == null) + PolicyValue = string.Empty; + Tenant.SetTenantCdnPolicy(CdnType, PolicyType, PolicyValue); AdminContext.ExecuteQueryRetry(); }