import Global from '../../_global.mdx';
import TabItem from '@theme/TabItem';
import Tabs from '@theme/Tabs';

# outlook message remove

Permanently removes a specific message from a mailbox

## Usage

```sh
m365 outlook message remove [options]
```

## Options

```md definition-list
`-i, --id <id>`
: ID of the message.

`--userId [userId]`
: ID of the user that owns the mailbox. Specify either `userId` or `userName`, but not both. This option is required when using application permissions.

`--userName [userName]`
: User principal name of the user that owns the mailbox. Specify either `userId` or `userName`, but not both. This option is required when using application permissions.

`-f, --force`
: Don't prompt for confirmation.
```

<Global />

## Permissions

<Tabs>
  <TabItem value="Delegated">

  | Resource        | Permissions               |
  |-----------------|---------------------------|
  | Microsoft Graph | Mail.ReadWrite            |

  </TabItem>
  <TabItem value="Application">

  | Resource        | Permissions                    |
  |-----------------|--------------------------------|
  | Microsoft Graph | Mail.ReadWrite                 |

  </TabItem>
</Tabs>

## Remarks

:::warning

This command will permanently delete the Outlook message. To move a message to the trash bin, use [outlook message move](./message-move.mdx) instead.

:::

## Examples

Remove a specific message for the currently signed-in user

```
m365 outlook message remove --id AAMkAGVmMDEzMTM4LTZmYWUtNDdkNC1hMDZiLTU1OGY5OTZhYmY4OABGAAAAAAAiQ8W967B7TKBjgx9rVEURBwAiIsqMbYjsT5e-T7KzowPTAAAAAAEMAAAiIsqMbYjsT5e-T7KzowPTAALvuv07AAA=
```

Remove a specific message in a shared mailbox

```
m365 outlook message remove --id AAMkAGVmMDEzMTM4LTZmYWUtNDdkNC1hMDZiLTU1OGY5OTZhYmY4OABGAAAAAAAiQ8W967B7TKBjgx9rVEURBwAiIsqMbYjsT5e-T7KzowPTAAAAAAEMAAAiIsqMbYjsT5e-T7KzowPTAALvuv07AAA= --userName sharedmailbox@contoso.com
```

Remove a specific message from a specific mailbox specified by user ID using application permissions

```
m365 outlook message remove --id AAMkAGVmMDEzMTM4LTZmYWUtNDdkNC1hMDZiLTU1OGY5OTZhYmY4OABGAAAAAAAiQ8W967B7TKBjgx9rVEURBwAiIsqMbYjsT5e-T7KzowPTAAAAAAEMAAAiIsqMbYjsT5e-T7KzowPTAALvuv07AAA= --userId 6799fd1a-723b-4eb7-8e52-41ae530274ca
```

Remove a specific message from a specific mailbox specified by user UPN using application permissions

```
m365 outlook message remove --id AAMkAGVmMDEzMTM4LTZmYWUtNDdkNC1hMDZiLTU1OGY5OTZhYmY4OABGAAAAAAAiQ8W967B7TKBjgx9rVEURBwAiIsqMbYjsT5e-T7KzowPTAAAAAAEMAAAiIsqMbYjsT5e-T7KzowPTAALvuv07AAA= --userName john.doe@contoso.com
```

## Response

The command won't return a response on success.
