I am trying to use the create subscription API to open a subscription channel on a calendar's events such that we can receive updates when interviewers respond to the interview.
I have tried many variations to get this request to work:
Permission Scopes
I have gone through the oauth process to retrieve graph access tokens for a user with the following permission Scopes:
Mail.SendCalendars.ReadWrite.SharedUser.ReadBasic.All
Successful Calendar Event Creation
Using the access tokens with the above scopes, before attempting to create the subscription, I add an event with {eventId} to a shared calendar, let's say with the user relative id of {sharedCalendarId}.
Subscription Creation Attempts
Using the same access tokens to create the same Authorization header with permission scopes listed above, I consistently receive the same ExtensionError response. Below I will list the various permutations of request I have made to the graph API.
Urls Attempted
I have sent each permutation of the subscription POST requests to the following URLs:
https://graph.microsoft.com/v1.0/subscriptionshttps://graph.microsoft.com/beta/subscriptions
Request Headers
Content-Type: application/jsonAuthorization: Bearer {authToken}
Request Bodies Attempted
The changeType and notificationUrl, and expirationDateTime are the same for all requests.
I have tried 3 different variations on the resource string, and have tried the request with and without the clientState.
First I tried the fully identified resource and added clientState:
{
"changeType": "created,updated",
"notificationUrl": "https://{domain-with-valid-https-certs}/calendar/microsoft/notifications",
"resource": "users/{userPrincipalName}/calendars/{sharedCalendarId}/events",
"clientState": "{thisIsLimitedTo128Characters}",
"expirationDateTime": "2018-05-23T21:02:45.487Z"
}
Next, I abandoned clientState for the sake of narrowing down the problem and I used me instead of {userPrincipalName}:
{
...
"resource": "me/calendars/{sharedCalendarId}/events"
}
Then I abandoned the shared calendar to see if that was the problem and used a resource that's an example in the docs.
{
...
"resource": "me/events"
}
Error Response Received
While I seem to receive the validation request to the notificationUrl provided (and the server responds appropriately) the request to create the subscription then responds with this kind of error:
{
code: "ExtensionError",
message: "Operation: Create; Exception: [Status Code: Forbidden; Reason: Forbidden]",
innerError: {
"request-id": "0d86a983-ea50-4226-905c-38f0e8f12308",
date: "2018-05-23T03:55:38"
}
}
What's confusing is that I am attempting to create this subscription on a calendar I have just successfully created or changed and event, so the 403 seems like it should not be related to access to the resource.
Are there specific permissions or scopes that need to be granted for us to successfully create subscriptions to a calendar's events? Is there a different API we should be using?
bb2425ff-e2e2-40b0-8f1b-26fe2541bb2e-992bc9ab-e53a-47ea-b171-f5367c8a9455-173e9c7a-0dba-483d-a765-58b444313de2- Leighton Wallace