Skip to main content

Move all emails

Move every email in a folder that matches the optional filters to another folder.

Command in the Microsoft 365 toolkit · id ooa.microsoft365/move_all_mail · 12 inputs (1 required), 1 output

Inputs​

InputTypeRequiredDefaultWhat it is
Access tokenCredentialNoMicrosoft Graph access token from the vault; or leave it empty and choose a connection that signs in, which gets and renews the token.
To folderStringYesDestination folder id, well-known name, or a path such as Inbox/Invoices/2026.
FolderStringNoinboxSource Folder id or well-known name: inbox, archive, sentitems, deleteditems.
Unread onlyBooleanNofalseOnly unread emails.
From containsStringNoSender contains this text; separate several with ; to match any of them.
Subject containsStringNoSubject contains this text; separate several with ; to match any of them.
Maximum resultsNumberNo1000Most emails to move in one run.
Read onlyBooleanNofalseOnly emails already read.
SinceDateTimeNoReceived on or after this time (UTC).
BeforeDateTimeNoReceived before this time (UTC).
MailboxStringNomeMailbox: me, or a user's email address (needs application permission).
Endpoint addressStringNohttps://graph.microsoft.com/v1.0Graph endpoint; change only for national clouds or testing.

Outputs​

OutputTypeWhat it is
countNumberNumber of emails moved.