Hi @Hattikoti, Roopa S,
The NotificationUrl
is mandatory when creating a subscription using Microsoft Graph. Microsoft Graph will send a POST request with the change notification to this URL. This endpoint should be accessible publicly. The error message you provided is generic. You will need to catch this exception and inspect its details to get a more specific idea of what's wrong.
Here is the sample code:
Dim subscription As New Subscription()
subscription.ChangeType = "created"
subscription.NotificationUrl = "https://your-endpoint.com/notificationListener"
subscription.Resource = "users/******@dell.com/mailFolders/Inbox/messages"
subscription.ExpirationDateTime = DateTimeOffset.UtcNow.AddHours(24) 'Note: Subscriptions cannot be eternal, they have a max lifespan
subscription.ClientState = clientSecret
Dim result = Await graphClient.Subscriptions.Request().AddAsync(subscription)
Here is the document you can refer.
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
Best regards,
Jalpa