Skip to content

Commit

Permalink
Fix Set-PnPWebhookSubscription to use same max range as Add-PnPWebhoo…
Browse files Browse the repository at this point in the history
…kSubscription (#3106)

Co-authored-by: Gautam Sheth <[email protected]>
  • Loading branch information
reusto and gautamdsheth authored May 17, 2023
1 parent 62600e2 commit 34736dd
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Commands/Webhooks/SetWebhookSubscription.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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()
{
Expand Down

0 comments on commit 34736dd

Please sign in to comment.