Microsoft365R 2.1.0 with Outlook support now on CRAN

[This article was first published on Revolutions, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

by Hong Ooi

I’m happy to announce that Microsoft365R 2.1.0 is now on CRAN with Outlook email support! Here’s a quick summary of the new 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

Here’s a sample of how to write an email using blastula:

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()

And on the other side, here’s a sample of how to work with the emails in your inbox:

# list the most recent emails in your inbox
emlst <- outl$list_emails()

# get the most recent email
em <- emlst[[1]]

# list and download attachments
em$list_attachments()
em$download_attachment("mydatafile.csv")

# reply to it
em$create_reply("Replying from R")$send()

# list the folders in your account
outl$list_folders()

# move the move recent email to a given folder
folder <- outl$get_folder("My project folder")
em$move(folder)

In addition, this release fixes a bug in the list_files() method for OneDrive/Sharepoint drives and drive items, and adds the ability to create nested drive folders in one call.

Please note 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.)

If you have any feedback or comments, you can email me or open an issue at the repo.

To leave a comment for the author, please follow the link and comment on their blog: Revolutions.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)