首页 > 解决方案 > 抑制 Outlook 弹出窗口允许在 R 中访问

问题描述

我在 R 中制作了一个脚本,该脚本通过 Outlook 中的邮件搜索确定的电子邮件。问题是每次脚本尝试访问我的电子邮件时,都会弹出一个窗口并请求许可。该脚本按预期工作,但进程减慢,因为我每次都必须在那里单击“允许”。我已经读到可以允许程序在 Trusct Center 选项中进入我的 Outlook,但 Windows 版本太旧,无法通过这种方式进行修复。此外,由于这是一个共享服务器,我没有管理员访问权限,因此无法进行重大更改。我读过其他类似的问题,但在 R 中没有,像这样[禁止 Outlook 弹出窗口允许访问或这个[如何在 PB8 中发送邮件时抑制 Outlook 弹出消息。这是我的脚本:

library(RDCOMClient)
library(stringr)

#Folder in OutLook where to look for the emails
folderName = "Specific folder"

OutApp <- COMCreate("Outlook.Application")
outlookNameSpace = OutApp$GetNameSpace("MAPI")

folder <- outlookNameSpace$Folders(1)$Folders(folderName)
folder$Name(1)
emails <- folder$Items

for (i in 1:emails()$Count()){
  subject <- emails(i)$Subject() #Get the subject of the email

  #If the subject of the email has an specific string print the body of the message
  if (grepl("Subject to look for", subject)== TRUE){
    body <- emails(i)$Body() # Here asks for permission
    print(body)
  }
}

有没有办法嵌入一段代码来避免这个弹出窗口或自动“点击”允许?

标签: rms-accessoutlook

解决方案


看起来您在 Outlook 中遇到了标准的安全提示。有可能的路线,你可以去:

  1. 使用 Outlook 所基于的低级代码 - 扩展 MAPI 或围绕此 API 的任何其他第三方包装器,例如 Redemption。

  2. 在 Outlook - Microsoft Outlook 安全管理器中使用为关闭此类安全触发器而设计的第三方组件。

  3. 设置组策略以避免此类触发器。

  4. 在系统上设置有效的防病毒软件。


推荐阅读