I have not been able to find a method of using the graph to subscribe to all users changes, it looks like it is not possible.
So I set about subscribing to everyone individually, ideally I would like all updates from calendars, email and contacts eventually, but I started with calendars.
The code works perfectly with just my user, however when I try to subscribe for everyone (around 300 users), I hit a hard a limit, at seven subscriptions, as in further requests fail with a generic Bad Request
status.
In the official docs https://developer.microsoft.com/en-us/graph/docs/api-reference/v1.0/resources/webhooks it says:
Limitations Certain limits apply and may generate errors when exceeded:
1) Maximum subscription quotas
- Per App: 50,000 total subscriptions
- Per Tenant: 35 total subscriptions across all apps
- Per App and Tenant combination: 7 total subscriptions
It seems that Tenant refers to an actual active directory, so we are limited to 7 per app, or 35 in total.
There is zero chance of splitting users into multi Active Directories of domains, even juggling multiple apps to do the same thing seems strange, these limits make no sense at all to me.
Is there any way to increase these tiny limits?
I am subscribing to users/$email/events
so I post to https://graph.microsoft.com/v1.0/subscriptions
{
"changeType": "created,updated,deleted",
"notificationUrl": "https://webhooks.mydomain.com/my/endpoint",
"resource": "users/$email/events",
"expirationDateTime":"2018-05-12T16:00:00.9356913Z",
"clientState": "my-super-secret-identifier"
}
And it works great, as long as I want <=7 subscriptions. I also subscribed to, the root /users to see if that would give me all changes, which meant I could then only subscribe to 6 individual calendars.
I am using the official PHP library, but presume/hope that doesn't matter.