Skip to content

Latest commit

 

History

History
267 lines (205 loc) · 9.41 KB

File metadata and controls

267 lines (205 loc) · 9.41 KB
title presence: setStatusMessage
description Set a presence status message for a user.
author afedorov
ms.localizationpriority medium
doc_type apiPageType
ms.subservice cloud-communications
ms.date 04/04/2024

presence: setStatusMessage

Namespace: microsoft.graph

Set a presence status message for a user. An optional expiration date and time can be supplied.

[!INCLUDE national-cloud-support]

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.

[!INCLUDE permissions-table]

HTTP Request

POST /users/{id}/presence/setStatusMessage

Request headers

Name Description
Authorization Bearer {token}. Required. Learn more about authentication and authorization.
Content-Type application/json. Required.

Request body

In the request body, provide a JSON object with the following parameters.

Parameter Type Description
statusMessage microsoft.graph.presenceStatusMessage Contains the presence status message of the user.

Response

If successful, this method returns a 200 OK response code.

Examples

Example 1: Set status message with expiry date

The following request sets the presence status message as "Hey I'm currently in a meeting." for user fa8bf3dc-eca7-46b7-bad1-db199b62afc3, with the expiration on 2022-10-18 at 17:05:33.2079781 Pacific Standard Time.

Request

POST https://graph.microsoft.com/v1.0/users/fa8bf3dc-eca7-46b7-bad1-db199b62afc3/presence/setStatusMessage
Content-Type: application/json

{
  "statusMessage": {
    "message": {
        "content": "Hey I'm currently in a meeting.",
        "contentType": "text"
    },
    "expiryDateTime": {
        "dateTime": "2022-10-18T17:05:33.2079781",
        "timeZone": "Pacific Standard Time"
    }
  }
}

[!INCLUDE sample-code] [!INCLUDE sdk-documentation]

[!INCLUDE sample-code] [!INCLUDE sdk-documentation]

[!INCLUDE sample-code] [!INCLUDE sdk-documentation]

[!INCLUDE sample-code] [!INCLUDE sdk-documentation]

[!INCLUDE sample-code] [!INCLUDE sdk-documentation]

[!INCLUDE sample-code] [!INCLUDE sdk-documentation]

[!INCLUDE sample-code] [!INCLUDE sdk-documentation]



Response

HTTP/1.1 200 OK

Example 2: Set status message of another user

The following request sets the presence status message as "Hey I am available now" for user fa8bf3dc-eca7-46b7-bad1-db199b62afc3. In Example 3, presence information for user fa8bf3dc-eca7-46b7-bad1-db199b62afc3 is obtained on behalf of another user via a getPresence request.

Request

POST https://graph.microsoft.com/v1.0/users/fa8bf3dc-eca7-46b7-bad1-db199b62afc3/presence/setStatusMessage
Content-Type: application/json

{
  "statusMessage": {
    "message": {
      "content": "Hey I am available now",
      "contentType": "text"
    }
  }
}

[!INCLUDE sample-code] [!INCLUDE sdk-documentation]

[!INCLUDE sample-code] [!INCLUDE sdk-documentation]

[!INCLUDE sample-code] [!INCLUDE sdk-documentation]

[!INCLUDE sample-code] [!INCLUDE sdk-documentation]

[!INCLUDE sample-code] [!INCLUDE sdk-documentation]

[!INCLUDE sample-code] [!INCLUDE sdk-documentation]

[!INCLUDE sample-code] [!INCLUDE sdk-documentation]



Response

HTTP/1.1 200 OK

Example 3: Get another user presence

This example follows Example 2. Presence information for user fa8bf3dc-eca7-46b7-bad1-db199b62afc3 is obtained on behalf of another user via a getPresence request.

Request

GET https://graph.microsoft.com/v1.0/users/fa8bf3dc-eca7-46b7-bad1-db199b62afc3/presence

[!INCLUDE sample-code] [!INCLUDE sdk-documentation]

[!INCLUDE sample-code] [!INCLUDE sdk-documentation]

[!INCLUDE sample-code] [!INCLUDE sdk-documentation]

[!INCLUDE sample-code] [!INCLUDE sdk-documentation]

[!INCLUDE sample-code] [!INCLUDE sdk-documentation]

[!INCLUDE sample-code] [!INCLUDE sdk-documentation]

[!INCLUDE sample-code] [!INCLUDE sdk-documentation]



Response

Because this request gets the presence status for another user, the statusMessage.expiryDateTime and statusMessage.publishedDateTime properties are not included in the response body.

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

{
  "id": "fa8bf3dc-eca7-46b7-bad1-db199b62afc3",
  "availability": "Available",
  "activity": "Available",
  "outOfOfficeSettings": {
    "message": null,
    "isOutOfOffice": false
  },
  "statusMessage": {
    "message": {
      "content": "Hey I am available now",
      "contentType": "text"
    }
  },
  "sequenceNumber": "A0129311063"
}