I want to get notifications on a specific event that I have created from my application. For that, I am using the below code to subscribe to a specific event.
var subscription = new Subscription
{
ChangeType = "updated,deleted",
NotificationUrl = $"{_notificationHost}/listen",
Resource = "me/events/{event-id}",
ClientState = Guid.NewGuid().ToString(),
IncludeResourceData = false,
// Subscription only lasts for one hour
ExpirationDateTime = DateTimeOffset.UtcNow.AddHours(1)
};
But while creating it throws an exception:
Error creating subscription: Code: ExtensionError Message: Operation: Create; Exception: [Status Code: BadRequest; Reason: The value 'https://outlook.office365.com/api/beta/Users('{userid}')/Events('{event-id}')' of parameter 'Resource' is not supported.]
Just ran into this same issue. It looks like the Subscription API doesn't support subscriptions on specific events, only the entire calendar. There's an example for subscriptions to events in the "Resources examples" section, which looks like exactly what you want: me/events
. The ID of the updated/deleted event is included in the callback, so if you only care about certain events, you can use that.