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.
Clear a presence session of an application for a user. If it is the user's only presence session, a successful clearPresence changes the user's presence to Offline/Offline.
The following permission is required to call the API. To learn more, including how to choose permissions, see Permissions.
Permission type
Permissions (from least to most privileged)
Delegated (work or school account)
Presence.ReadWrite
Delegated (personal Microsoft account)
Not Supported.
Application
Presence.ReadWrite.All
HTTP Request
POST /users/{userId}/presence/clearPresence
Request headers
Name
Description
Authorization
Bearer {token}. Required.
Content-Type
application/json. Required.
Request body
In the request body, provide a JSON object with the following parameters.
Parameter
Type
Description
sessionId
string
The ID of the application's presence session.
Important
Provide the ID of the application as sessionId in the request.
Response
If successful, this method returns a 200 OK response code.
If the presence session doesn't exist, this method returns a 404 NotFound response code.
Examples
The following request shows the application with ID 22553876-f5ab-4529-bffb-cfe50aa89f87 that clears its presence session for user fa8bf3dc-eca7-46b7-bad1-db199b62afc3.
POST https://graph.microsoft.com/beta/users/fa8bf3dc-eca7-46b7-bad1-db199b62afc3/presence/clearPresence
Content-Type: application/json
{
"sessionId": "22553876-f5ab-4529-bffb-cfe50aa89f87"
}
GraphServiceClient graphClient = new GraphServiceClient( authProvider );
var sessionId = "22553876-f5ab-4529-bffb-cfe50aa89f87";
await graphClient.Users["{user-id}"].Presence
.ClearPresence(sessionId)
.Request()
.PostAsync();
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
//THE GO SDK IS IN PREVIEW. NON-PRODUCTION USE ONLY
graphClient := msgraphsdk.NewGraphServiceClient(requestAdapter)
requestBody := msgraphsdk.NewSessionIdRequestBody()
sessionId := "22553876-f5ab-4529-bffb-cfe50aa89f87"
requestBody.SetSessionId(&sessionId)
userId := "user-id"
graphClient.UsersById(&userId).Presence().ClearPresence(user-id).Post(requestBody)
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.