Skip to main content

Save all attachments

Save the attachments of every email in a folder that matches the filters, optionally marking those emails as read.

Command in the Microsoft 365 toolkit · id ooa.microsoft365/save_all_mail_attachments · 15 inputs (1 required), 2 outputs

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.
Target folderFileYesFolder to save into.
Name patternStringNo*Only names matching this pattern, e.g. *.pdf.
FolderStringNoinboxFolder 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.
Read onlyBooleanNofalseOnly emails already read.
SinceDateTimeNoReceived on or after this time (UTC).
BeforeDateTimeNoReceived before this time (UTC).
OverwriteBooleanNofalseReplace files of the same name instead of adding a number such as (2).
Mark readBooleanNofalseMark each matching email as read afterwards.
Maximum resultsNumberNo1000Most emails handled in one run.
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
filesListSaved file paths.
email_countNumberNumber of emails that matched.