View source: R/download_mail_attachment.R
download_mail_attachment | R Documentation |
This uses the Microsoft365R
package to download email attachments via Microsoft 365. Connection will be made using connect_outlook()
.
download_mail_attachment(
path = getwd(),
filename = "mail_{name}_{datetime}",
search = "hasattachment:yes",
search_subject = NULL,
search_from = NULL,
search_when = NULL,
search_attachment = NULL,
folder = get_inbox_name(account = account),
n = 5,
sort = "received desc",
overwrite = TRUE,
skip_inline = TRUE,
account = connect_outlook(),
interactive_mode = interactive()
)
path |
location to save attachment(s) to |
filename |
new filename for the attachments, use
|
search |
an ODATA filter, ignores |
search_subject |
a character, equal to |
search_from |
a character, equal to |
search_when |
a Date vector of size 1 or 2, equal to |
search_attachment |
a character to use a regular expression for attachment file names |
folder |
email folder name to search in, defaults to Inbox of the current user by calling |
n |
maximum number of emails to search |
sort |
initial sorting |
overwrite |
a logical to indicate whether existing local files should be overwritten |
skip_inline |
a logical to indicate whether inline attachments such as meta images must be skipped |
account |
a Microsoft 365 account to use for searching the mails. This has to be an object as returned by |
interactive_mode |
a logical to indicate interactive mode. In non-interactive mode, all attachments within the search criteria will be downloaded. |
search_*
arguments will be matched as 'AND'.
search_from
can contain any sender name or email address. If search_when
has a length over 2, the first and last value will be taken.
Refer to this Microsoft Support page for all filtering options using the search
argument.
mail()
## Not run:
download_mail_attachment(search_when = "2021-10-28")
if (require("certetoolbox")) {
download_mail_attachment(search_from = "groningen",
search_when = last_week(),
filename = "groningen_{date_time}")
download_mail_attachment(search_from = "drenthe",
search_when = yesterday(),
n = 1)
}
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.