Skip to content

Commit 34736dd

Browse files
reustogautamdsheth
andauthored
Fix Set-PnPWebhookSubscription to use same max range as Add-PnPWebhookSubscription (#3106)
Co-authored-by: Gautam Sheth <gautamdsheth@outlook.com>
1 parent 62600e2 commit 34736dd

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/Commands/Webhooks/SetWebhookSubscription.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ namespace PnP.PowerShell.Commands.Webhooks
1111
[OutputType(typeof(WebhookSubscription))]
1212
public class SetWebhookSubscription : PnPWebCmdlet
1313
{
14-
public const int DefaultValidityInMonths = 6;
14+
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
1515
public const int ValidityDeltaInDays = -72; // Note: Some expiration dates too close to the limit are rejected
16-
16+
1717
[Parameter(Mandatory = true, ValueFromPipeline = true, Position = 0)]
1818
public WebhookSubscriptionPipeBind Subscription;
1919

@@ -24,7 +24,7 @@ public class SetWebhookSubscription : PnPWebCmdlet
2424
public string NotificationUrl;
2525

2626
[Parameter(Mandatory = false)]
27-
public DateTime ExpirationDate = DateTime.Today.ToUniversalTime().AddMonths(DefaultValidityInMonths).AddHours(ValidityDeltaInDays);
27+
public DateTime ExpirationDate = DateTime.Today.ToUniversalTime().AddDays(DefaultValidityInDays).AddHours(ValidityDeltaInDays);
2828

2929
protected override void ExecuteCmdlet()
3030
{

0 commit comments

Comments
 (0)