【问题标题】:RDCOMClient error - No support for InterfaceSupportsErrorInfoRDCOMClient 错误 - 不支持 InterfaceSupportsErrorInfo
【发布时间】:2020-01-07 06:55:50
【问题描述】:

我在 R 中运行一项日常任务,该任务从我的 Outlook 中检索一封电子邮件(附有 csv 文件),对 csv 文件执行一些分析,并将生成的数据帧写入我公司的本地驱动器。某天早上发现文件没有送达,根据日志,原因是如下错误:

<checkErrorInfo> 80020009 
No support for InterfaceSupportsErrorInfo
checkErrorInfo -2147352567
Error: Exception occurred.
Execution halted

我找不到发生这种情况的日子和不发生这种情况的日子的任何模式。一旦我手动触发任务,它通常运行良好。

我在其他问题中看到过这个错误,但这些问题与通过 Outlook 发送附件有关,我没有这样做。下面是我访问 Outlook 和检索数据的代码:

library(RDCOMClient)    

outlook_app <- COMCreate("Outlook.Application")

search <- outlook_app$AdvancedSearch(
  "Inbox",
  "urn:schemas:httpmail:subject = 'My_Subject'"

)
Sys.sleep(5)

results <- search$Results()

for (i in 1:results$Count()) {
  if (as.Date("1899-12-30") + floor(results$Item(i)$ReceivedTime()) 
      == as.Date(strptime(Sys.time(),format = "%Y-%m-%d"))) {
    email <- results$Item(i)
  }
}

attachment_file <- tempfile()
email$Attachments(1)$SaveAsFile(attachment_file)
data <- read.csv(attachment_file,sep=",",fileEncoding="UCS-2LE")

【问题讨论】:

    标签: r outlook rdcomclient


    【解决方案1】:

    有没有可能是你的代码运行时没有文件,或者你的 sys.sleep 太短了?

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-01-20
      • 2015-05-11
      • 2015-02-08
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多