message: unsubscribe

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.

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.

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) Mail.Send Not available.
Delegated (personal Microsoft account) Mail.Send Not available.
Application Mail.Send Not available.

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
Response

The following example shows the response.

HTTP/1.1 202 Accepted