Skip to content

Latest commit

 

History

History
122 lines (92 loc) · 4.83 KB

File metadata and controls

122 lines (92 loc) · 4.83 KB
title message: unsubscribe
description Submits an email request on behalf of the signed-in user to unsubscribe from an email distribution list. Uses the information in the `List-Unsubscribe` header.
author SuryaLashmiS
ms.localizationpriority medium
ms.subservice outlook
doc_type apiPageType
ms.date 06/21/2024

message: unsubscribe

Namespace: microsoft.graph

[!INCLUDE beta-disclaimer]

Submits an email request on behalf of the signed-in user to unsubscribe from an email distribution list. Uses the information in the List-Unsubscribe header.

Message senders can use mailing lists in a user-friendly way by including an option for recipients to opt out. They can do so by specifying the List-Unsubscribe header in each message following RFC-2369.

Note In particular, for the unsubscribe action to work, the sender must specify mailto: and not URL-based unsubscribe information.

Setting that header would also set the unsubscribeEnabled property of the message instance to true, and the unsubscribeData property to the header data.

If the unsubscribeEnabled property of a message is true, you can use the unsubscribe action to unsubscribe the user from similar future messages as managed by the message sender.

A successful unsubscribe action moves the message to the Deleted Items folder. The actual exclusion of the user from future mail distribution is managed by the sender.

[!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 | userPrincipalName}/messages/{id}/unsubscribe

Request headers

Name Type Description
Authorization string 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 202 Accepted response code. It doesn't return anything in the response body.

Example

Here's an example of how to call this API.

Request

The following example shows a request.

POST https://graph.microsoft.com/beta/me/messages/{id}/unsubscribe

[!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

The following example shows the response.

HTTP/1.1 202 Accepted