Redigera

Dela via


Get presence

Namespace: microsoft.graph

Get a user's presence information.

This API is available in the following national cloud deployments.

Global service US Government L4 US Government L5 (DOD) China operated by 21Vianet

Permissions

Choose the permission or permissions marked as least privileged for this API. Use a higher privileged permission or permissions only if your app requires it. For details about delegated and application permissions, see Permission types. To learn more about these permissions, see the permissions reference.

Permission type Least privileged permissions Higher privileged permissions
Delegated (work or school account) Presence.Read Presence.Read.All
Delegated (personal Microsoft account) Not supported. Not supported.
Application Presence.Read.All Presence.ReadWrite.All

Note

  • You can't use application permissions to access APIs under the /me path.
  • The maximum request rate for this API is 1500 API requests in a 30 second period, per application per tenant.

HTTP Request

GET /users/{id}/presence
GET /communications/presences
GET /me/presence

Request Headers

Name Description
Authorization Bearer {token}. Required. Learn more about authentication and authorization.

Request body

Don't supply a request body for this method.

Response

If successful, this method returns a 200 OK response code and a presence object in the response body.

Examples

Example 1: Get your own presence information

The following example shows how to get your own presence information. This operation requires the Presence.Read permission.

Request

GET https://graph.microsoft.com/v1.0/me/presence

Response

HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 1574

{
	"id": "fa8bf3dc-eca7-46b7-bad1-db199b62afc3",
	"availability": "Available",
	"activity": "Available"
}

Example 2: Get the presence information of another user

The following example shows how to get the presence information for another user. This operation requires the Presence.Read.All permission.

Request

GET https://graph.microsoft.com/v1.0/users/66825e03-7ef5-42da-9069-724602c31f6b/presence

Response

HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 1574

{
	"id": "66825e03-7ef5-42da-9069-724602c31f6b",
	"availability": "DoNotDisturb",
	"activity": "Presenting"
}

Example 3: Get the presence information of another user

The following example shows how to get the presence information for another user. This operation requires the Presence.Read.All permission.

Request

GET https://graph.microsoft.com/v1.0/communications/presences/dc74d9bb-6afe-433d-8eaa-e39d80d3a647

Response

HTTP/1.1 200 OK

{
    "value": [
        {
            "id": "dc74d9bb-6afe-433d-8eaa-e39d80d3a647",
            "availability": "Away",
            "activity": "BeRightBack"
        }
    ]
}