Reputation: 1617
I would like to get events from selected rooms in microsoft graph (rooms are users too). As I understand the API from graph: I need to call
GET /users/{id | userPrincipalName}/events/
for each user/room to get all events for rooms or I need to create groups and call:
GET /groups/{id}/events/
Is there a possibility to pass more than 1 Id to get different results ? Or any other way to get events from provided range of users (rooms)?
Cheers
Upvotes: 1
Views: 1398
Reputation: 14649
There is no such REST can return the events of multiple users directly. However we can use the batch request to send the multiple request in a single request.
Here is a sample that retrieve events from two users:
POST https://graph.microsoft.com/beta/$batch
Accept: application/json
Content-Type: application/json
authorization: bearer {access_token}
{
"requests": [
{
"id": "1",
"method": "GET",
"url": "/users/user1@{tenantName}.onmicrosoft.com/events"
},
{
"id": "2",
"method": "GET",
"url": "/users/user1@{tenantName}.onmicrosoft.com/events"
}
]
}
To read events from multiple users, Read calendars in all mailboxes is required. You can use the client credential flow to acquire the token for this permission. More detail about batch request please refer link below:
Combine multiple requests in one HTTP call using JSON batching (preview)
Upvotes: 1