RDCOMClient with COMCreate("Outlook.Application") crashing R

Viewed 1180

I'm using the package RDCOMClient with R version 4.0.2. It was downloaded using:

devtools::install_github("omegahat/RDCOMClient")

I'd like to use the package for reading and writing email. I've started this way:

library(RDCOMClient)
folderName <- "AUX"
OutApp <- COMCreate("Outlook.Application")

However, when I try to use any method from OutApp, R crashes, regardless of whether I'm using console R or RStudio. For example:

outMail = OutApp$CreateItem(0)
outlookNameSpace = OutApp$GetNameSpace("MAPI")

Either of these code chunks cause R to encounter a fatal error and the session to be terminated. No errors/warnings along the way, just an immediate crash. str(OutApp) returns that OutApp is of formal class COMIDispatch [package "RDComClient"] with 1 slot (.. @ ref:). OutApp is of length 1 and mode S4.

Any suggestions?

1 Answers

A minimal commit was created by a helpful user, due to which the code in OP will work for R > 4.0.

Use the following installation:

library(remotes) 
remotes::install_github("BSchamberger/RDCOMClient", ref = "main")

More discussion at this link.

Related