Namespace: microsoft.graph
Important
APIs under the /beta
version in Microsoft Graph are subject to change. Use of these APIs in production applications is not supported. To determine whether an API is available in v1.0, use the Version selector.
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.
HTTP Request
GET /users/{id}/presence
GET /communications/presences
GET /me/presence
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
The following example shows how to get your own presence information. This operation requires the Presence.Read permission.
Request
GET https://graph.microsoft.com/beta/me/presence
// Code snippets are only available for the latest version. Current version is 5.x
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Me.Presence.GetAsync();
mgc-beta users presence get --user-id {user-id}
// Code snippets are only available for the latest major version. Current major version is $v0.*
// Dependencies
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-beta-sdk-go"
//other-imports
)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
presence, err := graphClient.Me().Presence().Get(context.Background(), nil)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
Presence result = graphClient.me().presence().get();
const options = {
authProvider,
};
const client = Client.init(options);
let presence = await client.api('/me/presence')
.version('beta')
.get();
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$result = $graphServiceClient->me()->presence()->get()->wait();
Import-Module Microsoft.Graph.Beta.CloudCommunications
# A UPN can also be used as -UserId.
Get-MgBetaUserPresence -UserId $userId
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph_beta import GraphServiceClient
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
result = await graph_client.me.presence.get()
Response
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 1574
{
"id": "fa8bf3dc-eca7-46b7-bad1-db199b62afc3",
"availability": "Available",
"activity": "Available",
"outOfOfficeSettings": {
"message": null,
"isOutOfOffice": false
},
"sequenceNumber": "A0129311063"
}
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/beta/users/66825e03-7ef5-42da-9069-724602c31f6b/presence
// Code snippets are only available for the latest version. Current version is 5.x
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Users["{user-id}"].Presence.GetAsync();
mgc-beta users presence get --user-id {user-id}
// Code snippets are only available for the latest major version. Current major version is $v0.*
// Dependencies
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-beta-sdk-go"
//other-imports
)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
presence, err := graphClient.Users().ByUserId("user-id").Presence().Get(context.Background(), nil)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
Presence result = graphClient.users().byUserId("{user-id}").presence().get();
const options = {
authProvider,
};
const client = Client.init(options);
let presence = await client.api('/users/66825e03-7ef5-42da-9069-724602c31f6b/presence')
.version('beta')
.get();
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$result = $graphServiceClient->users()->byUserId('user-id')->presence()->get()->wait();
Import-Module Microsoft.Graph.Beta.CloudCommunications
Get-MgBetaUserPresence -UserId $userId
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph_beta import GraphServiceClient
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
result = await graph_client.users.by_user_id('user-id').presence.get()
Response
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 1574
{
"id": "66825e03-7ef5-42da-9069-724602c31f6b",
"availability": "DoNotDisturb",
"activity": "Presenting",
"outOfOfficeSettings": {
"message": null,
"isOutOfOffice": false
},
"sequenceNumber": "A0129311063"
}
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/beta/communications/presences/dc74d9bb-6afe-433d-8eaa-e39d80d3a647
// Code snippets are only available for the latest version. Current version is 5.x
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Communications.Presences["{presence-id}"].GetAsync();
mgc-beta communications presences get --presence-id {presence-id}
// Code snippets are only available for the latest major version. Current major version is $v0.*
// Dependencies
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-beta-sdk-go"
//other-imports
)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
presences, err := graphClient.Communications().Presences().ByPresenceId("presence-id").Get(context.Background(), nil)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
Presence result = graphClient.communications().presences().byPresenceId("{presence-id}").get();
const options = {
authProvider,
};
const client = Client.init(options);
let presence = await client.api('/communications/presences/dc74d9bb-6afe-433d-8eaa-e39d80d3a647')
.version('beta')
.get();
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$result = $graphServiceClient->communications()->presences()->byPresenceId('presence-id')->get()->wait();
Import-Module Microsoft.Graph.Beta.CloudCommunications
Get-MgBetaCommunicationPresence -PresenceId $presenceId
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph_beta import GraphServiceClient
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
result = await graph_client.communications.presences.by_presence_id('presence-id').get()
Response
HTTP/1.1 200 OK
{
"id": "dc74d9bb-6afe-433d-8eaa-e39d80d3a647",
"availability": "Away",
"activity": "BeRightBack",
"outOfOfficeSettings": {
"message": null,
"isOutOfOffice": false
},
"sequenceNumber": "A0129311063"
}
Related content