Meeting, Teams, and Graph
Using Graph
The Graph API offers many features and a wide range of endpoints that can provide all kinds of data about your organization.
Graph Explorer lets you make calls directly from the browser:
To obtain your organization's presence data, you first need to know the Microsoft IDs of the people in your organization.
Microsoft IDs are in UUID format, for example: 438f6dae-509e-4da2-bbb1-dc5a1697147f
To obtain user presence data, we can call the Graph /users/ endpoint to retrieve user data, and then use their UUIDs with the Presence endpoint.
Presence
The Presence endpoint to retrieve the presence of a single user is:
GET: GRAPH_URL/beta/users/{user-id}/presence
{user-id} = Microsoft UUID
GET: GRAPH_URL/beta/users/cb4bff89-8832-4c5f-a1ad-15efc6e8f203/presence will therefore return:
{
"id": "cb4bff89-8832-4c5f-a1ad-15efc6e8f203",
"availability": "Available",
"activity": "Available",
"statusMessage": null,
"outOfOfficeSettings": {
"message": null,
"isOutOfOffice": false
}
}
The user is online (Available) and has not configured an absence message.
Multiple users
To retrieve the presence of multiple users, there is no need to loop through users and call the endpoint each time (performance degrades quickly).
There is a special endpoint:
POST: GRAPH_URL/beta/communications/getPresencesByUserId
You can simply post a JSON containing the Microsoft UUIDs of your users; the response will look like this:
....
{
"id": "7bc1614e-f552-4167-91c2-7fe83a783b64",
"availability": "Offline",
"activity": "Offline",
"statusMessage": null,
"outOfOfficeSettings": {
"message": null,
"isOutOfOffice": false
}
},
{
"id": "0b4f2b85-4788-42a3-98bf-2ea289e66ed5",
"availability": "Offline",
"activity": "Offline",
"statusMessage": null,
"outOfOfficeSettings": {
"message": null,
"isOutOfOffice": false
}
},
....