From 34736dde02180daa104d746b60cc41fb3f0aaa88 Mon Sep 17 00:00:00 2001 From: reusto <1266516+reusto@users.noreply.github.com> Date: Wed, 17 May 2023 09:08:53 +0200 Subject: [PATCH] Fix Set-PnPWebhookSubscription to use same max range as Add-PnPWebhookSubscription (#3106) Co-authored-by: Gautam Sheth --- src/Commands/Webhooks/SetWebhookSubscription.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Commands/Webhooks/SetWebhookSubscription.cs b/src/Commands/Webhooks/SetWebhookSubscription.cs index 8cde07718..c6f9b4a44 100644 --- a/src/Commands/Webhooks/SetWebhookSubscription.cs +++ b/src/Commands/Webhooks/SetWebhookSubscription.cs @@ -11,9 +11,9 @@ namespace PnP.PowerShell.Commands.Webhooks [OutputType(typeof(WebhookSubscription))] public class SetWebhookSubscription : PnPWebCmdlet { - public const int DefaultValidityInMonths = 6; + public const int DefaultValidityInDays = 180; // Note: the max is 180 days not 6 months - https://learn.microsoft.com/sharepoint/dev/apis/webhooks/overview-sharepoint-webhooks public const int ValidityDeltaInDays = -72; // Note: Some expiration dates too close to the limit are rejected - + [Parameter(Mandatory = true, ValueFromPipeline = true, Position = 0)] public WebhookSubscriptionPipeBind Subscription; @@ -24,7 +24,7 @@ public class SetWebhookSubscription : PnPWebCmdlet public string NotificationUrl; [Parameter(Mandatory = false)] - public DateTime ExpirationDate = DateTime.Today.ToUniversalTime().AddMonths(DefaultValidityInMonths).AddHours(ValidityDeltaInDays); + public DateTime ExpirationDate = DateTime.Today.ToUniversalTime().AddDays(DefaultValidityInDays).AddHours(ValidityDeltaInDays); protected override void ExecuteCmdlet() {