Reputation: 295
I've been using the RDCOMClient packge in R for over a year now without a problem.
Now suddenly it's giving me an error:
<checkErrorInfo> 80070057
No support for InterfaceSupportsErrorInfo
checkErrorInfo -2147024809
Error: The parameter is incorrect.
Here is my code (I've cleaned the code due to privacy):
library(RDCOMClient)
library(lubridate)
rmarkdown::render("/report.Rmd", encoding = "UTF-8")
OutApp <- COMCreate("Outlook.Application")
outMail = OutApp$CreateItem(0)
text <- paste("Attached is the report")
path_to_attachment <- "W:\\Rwd\\report\\report_this_month\\report.pdf"
outMail[["to"]] = "[email protected]"
outMail[["subject"]] = "Monthly report"
outMail[["htmlbody"]] = text
outMail[["attachments"]]$Add(path_to_attachment)
outMail$Send()
rm(OutApp, outMail)
I have few other scripts that I schedule to send emails. One of them uses the blastula package (also sends email through Outlook) and I have no problem there.
Any idea why I'm getting this error?
Upvotes: 6
Views: 2751
Reputation: 367
I had a similar problem when trying to use RDCOMClient to print a pdf from a word d. What worked for me was to use the URI for the file location even if it is a local file. So for example:
path_to_attachment <- "file:/W:/Rwd/report/report_this_month/report.pdf"
Upvotes: 1
Reputation: 1173
I came across this error and was clueless for a while, but in my case it ended up being a matter of my attachment filepath being wrong.
If I were you I would try to first comment out the line outMail[["attachments"]]$Add(path_to_attachment)
and see if things work as expected.
Upvotes: 0