by Hong Ooi
This is an announcement that a beta Outlook email client is now part of the Microsoft365R package. You can install it from the GitHub repository with:
devtools::install_github("Azure/Microsoft365R")
The client provides the following features:
- Send, reply to and forward emails, optionally composed with blastula or emayili
- Copy and move emails between folders
- Create, delete, copy and move folders
- Add, remove and download attachments
The plan is to submit this to CRAN sometime next month, after a period of public testing. Please give it a try and give me your feedback: either via email or by opening an issue at the repo.
Here’s a small sample of the client in action (taken from the README):
library(Microsoft365R)
# 1st one is for your personal Microsoft account
# 2nd is for your work & school account
outl <- get_personal_outlook()
outlb <- get_business_outlook()
# compose an email with blastula
library(blastula)
bl_body <- "## Hello!
This is an email message that was generated by the blastula package.
We can use **Markdown** formatting with the `md()` function.
Cheers,
The blastula team"
bl_em <- compose_email(
body=md(bl_body),
footer=md("sent via Microsoft365R")
)
em <- outl$create_email(bl_em, subject="Hello from R",
to="[email protected]")
# add an attachment and send it
em$add_attachment("mydocument.docx")
em$send()
# list the most recent emails in your inbox
emlst <- outl$list_emails()
# reply to the most recent email
emlst[[1]]$
create_reply("Replying from R")$
send()
Please note though, that if you’re using one of the workarounds mentioned in the authentication vignette, they won’t work with Outlook. You’ll need to get the Microsoft365R app approved for your tenant, or alternatively, if you have admin rights you can create your own tenant with the required permissions. (This applies if you’re using Microsoft365R at work; if you’re using it at home on your personal account, you shouldn’t have any problems.)