Delete all emails
Delete every email in a folder that matches the optional filters, to Deleted Items or permanently.
Command in the Microsoft 365 toolkit · id ooa.microsoft365/delete_all_mail · 12 inputs, 1 output
Inputs
| Input | Type | Required | Default | What it is |
|---|---|---|---|---|
| Access token | Credential | No | Microsoft Graph access token from the vault; or leave it empty and choose a connection that signs in, which gets and renews the token. | |
| Folder | String | No | inbox | Folder id or well-known name: inbox, archive, sentitems, deleteditems. |
| Unread only | Boolean | No | false | Only unread emails. |
| From contains | String | No | Sender contains this text; separate several with ; to match any of them. | |
| Subject contains | String | No | Subject contains this text; separate several with ; to match any of them. | |
| Permanent | Boolean | No | false | Remove permanently instead of moving to Deleted Items. |
| Maximum results | Number | No | 1000 | Most emails to delete in one run. |
| Read only | Boolean | No | false | Only emails already read. |
| Since | DateTime | No | Received on or after this time (UTC). | |
| Before | DateTime | No | Received before this time (UTC). | |
| Mailbox | String | No | me | Mailbox: me, or a user's email address (needs application permission). |
| Endpoint address | String | No | https://graph.microsoft.com/v1.0 | Graph endpoint; change only for national clouds or testing. |
Outputs
| Output | Type | What it is |
|---|---|---|
| count | Number | Number of emails deleted. |