by Hong Ooi
- 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[] # 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.