Note:
This API allows users to subscribe only to another user's presence. If an application wants to subscribe to presence information for all users, it uses fictitious users to create the subscription to collect the required data.
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.All
Not available.
Delegated (personal Microsoft account)
Not supported.
Not supported.
Application
Presence.Read.All
Presence.ReadWrite.All
Note:
Maximum of 650 user IDs are supported per API request.
The maximum request rate of this API is 1500 API requests in a 30 second period, per application per tenant.
POST https://graph.microsoft.com/v1.0/communications/getPresencesByUserId
Content-Type: application/json
{
"ids": ["fa8bf3dc-eca7-46b7-bad1-db199b62afc3", "66825e03-7ef5-42da-9069-724602c31f6b"]
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Communications.GetPresencesByUserId;
var requestBody = new GetPresencesByUserIdPostRequestBody
{
Ids = new List<string>
{
"fa8bf3dc-eca7-46b7-bad1-db199b62afc3",
"66825e03-7ef5-42da-9069-724602c31f6b",
},
};
// To initialize your graphClient, see https://video2.skills-academy.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Communications.GetPresencesByUserId.PostAsGetPresencesByUserIdPostResponseAsync(requestBody);
// Code snippets are only available for the latest major version. Current major version is $v1.*
// Dependencies
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-sdk-go"
graphcommunications "github.com/microsoftgraph/msgraph-sdk-go/communications"
//other-imports
)
requestBody := graphcommunications.NewGetPresencesByUserIdPostRequestBody()
ids := []string {
"fa8bf3dc-eca7-46b7-bad1-db199b62afc3",
"66825e03-7ef5-42da-9069-724602c31f6b",
}
requestBody.SetIds(ids)
// To initialize your graphClient, see https://video2.skills-academy.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
getPresencesByUserId, err := graphClient.Communications().GetPresencesByUserId().PostAsGetPresencesByUserIdPostResponse(context.Background(), requestBody, nil)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
com.microsoft.graph.communications.getpresencesbyuserid.GetPresencesByUserIdPostRequestBody getPresencesByUserIdPostRequestBody = new com.microsoft.graph.communications.getpresencesbyuserid.GetPresencesByUserIdPostRequestBody();
LinkedList<String> ids = new LinkedList<String>();
ids.add("fa8bf3dc-eca7-46b7-bad1-db199b62afc3");
ids.add("66825e03-7ef5-42da-9069-724602c31f6b");
getPresencesByUserIdPostRequestBody.setIds(ids);
var result = graphClient.communications().getPresencesByUserId().post(getPresencesByUserIdPostRequestBody);
<?php
use Microsoft\Graph\GraphServiceClient;
use Microsoft\Graph\Generated\Communications\GetPresencesByUserId\GetPresencesByUserIdPostRequestBody;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new GetPresencesByUserIdPostRequestBody();
$requestBody->setIds(['fa8bf3dc-eca7-46b7-bad1-db199b62afc3', '66825e03-7ef5-42da-9069-724602c31f6b', ]);
$result = $graphServiceClient->communications()->getPresencesByUserId()->post($requestBody)->wait();
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph import GraphServiceClient
from msgraph.generated.communications.get_presences_by_user_id.get_presences_by_user_id_post_request_body import GetPresencesByUserIdPostRequestBody
# To initialize your graph_client, see https://video2.skills-academy.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = GetPresencesByUserIdPostRequestBody(
ids = [
"fa8bf3dc-eca7-46b7-bad1-db199b62afc3",
"66825e03-7ef5-42da-9069-724602c31f6b",
],
)
result = await graph_client.communications.get_presences_by_user_id.post(request_body)