Class SubscriptionsUtility
Class that deals with Microsoft Graph Subscriptions
Inheritance
Namespace: PnP.Framework.Graph
Assembly: PnP.Framework.dll
Syntax
public static class SubscriptionsUtility : object
Methods
CreateSubscription(GraphSubscriptionChangeType, String, String, DateTimeOffset, String, String, GraphSubscriptionTlsVersion, Int32, Int32, AzureEnvironment)
Creates a new Microsoft Graph Subscription
Declaration
public static Subscription CreateSubscription(GraphSubscriptionChangeType changeType, string notificationUrl, string resource, DateTimeOffset expirationDateTime, string clientState, string accessToken, GraphSubscriptionTlsVersion latestSupportedTlsVersion = GraphSubscriptionTlsVersion.v1_2, int retryCount = 10, int delay = 500, AzureEnvironment azureEnvironment = default(AzureEnvironment))
Parameters
Graph The event(s) the subscription should trigger on |
System. The URL that should be called when an event matching this subscription occurs |
System. The resource to monitor for changes. See https://docs.microsoft.com/graph/api/subscription-post-subscriptions#permissions for the list with supported options. |
Date The datetime defining how long this subscription should stay alive before which it needs to get extended to stay alive. See https://docs.microsoft.com/graph/api/resources/subscription#maximum-length-of-subscription-per-resource-type for the supported maximum lifetime of the subscriber endpoints. |
System. Specifies the value of the clientState property sent by the service in each notification. The maximum length is 128 characters. The client can check that the notification came from the service by comparing the value of the clientState property sent with the subscription with the value of the clientState property received with each notification. |
System. The OAuth 2.0 Access Token to use for invoking the Microsoft Graph |
Graph Specifies the latest version of Transport Layer Security (TLS) that the notification endpoint, specified by |
System. Number of times to retry the request in case of throttling |
System. Milliseconds to wait before retrying the request. The delay will be increased (doubled) every retry |
Azure Defines the Azure Cloud Deployment. This is used to determine the MS Graph EndPoint to call which differs per Azure Cloud deployments. Defaults to Production (graph.microsoft.com). |
Returns
Subscription
The just created Microsoft Graph subscription |
DeleteSubscription(String, String, Int32, Int32)
Deletes an existing Microsoft Graph Subscription
Declaration
public static void DeleteSubscription(string subscriptionId, string accessToken, int retryCount = 10, int delay = 500)
Parameters
System. Unique identifier of the Microsoft Graph subscription |
System. The OAuth 2.0 Access Token to use for invoking the Microsoft Graph |
System. Number of times to retry the request in case of throttling |
System. Milliseconds to wait before retrying the request. The delay will be increased (doubled) every retry |
GetSubscription(String, Guid, Int32, Int32, Int32, Int32, AzureEnvironment)
Returns the subscription with the provided subscriptionId from Microsoft Graph
Declaration
public static Subscription GetSubscription(string accessToken, Guid subscriptionId, int startIndex = 0, int endIndex = 999, int retryCount = 10, int delay = 500, AzureEnvironment azureEnvironment = default(AzureEnvironment))
Parameters
System. The OAuth 2.0 Access Token to use for invoking the Microsoft Graph |
Guid
subscriptionId
The unique identifier of the subscription to return from Microsoft Graph |
System. First item in the results returned by Microsoft Graph to return |
System. Last item in the results returned by Microsoft Graph to return |
System. Number of times to retry the request in case of throttling |
System. Milliseconds to wait before retrying the request. The delay will be increased (doubled) every retry. |
Azure Defines the Azure Cloud Deployment. This is used to determine the MS Graph EndPoint to call which differs per Azure Cloud deployments. Defaults to Production (graph.microsoft.com). |
Returns
Subscription
Subscription object |
ListSubscriptions(String, Int32, Int32, Int32, Int32, AzureEnvironment)
Returns all the active Microsoft Graph subscriptions
Declaration
public static List<Subscription> ListSubscriptions(string accessToken, int startIndex = 0, int endIndex = 999, int retryCount = 10, int delay = 500, AzureEnvironment azureEnvironment = default(AzureEnvironment))
Parameters
System. The OAuth 2.0 Access Token to use for invoking the Microsoft Graph |
System. First item in the results returned by Microsoft Graph to return |
System. Last item in the results returned by Microsoft Graph to return |
System. Number of times to retry the request in case of throttling |
System. Milliseconds to wait before retrying the request. The delay will be increased (doubled) every retry. |
Azure Defines the Azure Cloud Deployment. This is used to determine the MS Graph EndPoint to call which differs per Azure Cloud deployments. Defaults to Production (graph.microsoft.com). |
Returns
List<Subscription>
List with Subscription objects |
UpdateSubscription(String, DateTimeOffset, String, Int32, Int32, AzureEnvironment)
Updates an existing Microsoft Graph Subscription
Declaration
public static Subscription UpdateSubscription(string subscriptionId, DateTimeOffset expirationDateTime, string accessToken, int retryCount = 10, int delay = 500, AzureEnvironment azureEnvironment = default(AzureEnvironment))
Parameters
System. Unique identifier of the Microsoft Graph subscription |
Date The datetime defining how long this subscription should stay alive before which it needs to get extended to stay alive. See https://docs.microsoft.com/graph/api/resources/subscription#maximum-length-of-subscription-per-resource-type for the supported maximum lifetime of the subscriber endpoints. |
System. The OAuth 2.0 Access Token to use for invoking the Microsoft Graph |
System. Number of times to retry the request in case of throttling |
System. Milliseconds to wait before retrying the request. The delay will be increased (doubled) every retry |
Azure Defines the Azure Cloud Deployment. This is used to determine the MS Graph EndPoint to call which differs per Azure Cloud deployments. Defaults to Production (graph.microsoft.com). |
Returns
Subscription
The just updated Microsoft Graph subscription |