Beta Outlook email support in Microsoft365R

Hello all,

This is an announcement that I've now added an Outlook email client into the Microsoft365R package. You can give it a whirl with

devtools::install_github("Azure/Microsoft365R")

Here's a quick summary of it in action (taken from the README):

library(Microsoft365R)

# first 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="bob@example.com")

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

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

I'll be adding a vignette going into more detail in the next few days, prior to submitting to CRAN sometime next month. You can also type ?ms_outlook, ?ms_outlook_folder and ?ms_outlook_email for online help on the relevant classes. In the meantime, you can also ask any questions here.

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 for your personal email, you shouldn't have any problems.)

Have fun!

2 Likes

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.