Outlook$CreateItem(0) crashes R (using package RDCOMClient)

321 Views Asked by At

I solved this issue but documenting here in case anyone experiences difficulty using RDCOMClient to send Outlook emails via R.

Using fresh install of Windows 10 Pro for Workstations running as a VirtualBox VM, R version 4.1.1, Rstudio 2021.09.0 (Build 351), and Microsoft Office365 Outlook client (version 2102 (Build 13801.20960 Click-to-Run)).

The following code causes R to crash every time on the last line:

install.packages("RDCOMClient", repos = "http://www.omegahat.net/R")
library(RDCOMClient)

# Open Outlook
Outlook <- COMCreate("Outlook.Application")

# Create a new message
Email = Outlook$CreateItem(0)

I rolled back the R version to 3.5.1 -- and it now works.

Conclusion: RDCOMClient is not compatible with latest version of R (4.1.1).

1

There are 1 best solutions below

0
cmcgraw On

I rolled back the R version to 3.5.1 -- and it now works.

Conclusion: RDCOMClient is not compatible with latest version of R (4.1.1). I am not sure why and did not trouble-shoot further, since I only need this VM with RStudio to perform one function (send email by Outlook).