1

I have made an script in R that goes through my mail in Outlook in search of determined emails. The thing is that everytime that the script tries to access my emails a window pop-ups and ask for permission. The script works as intended but the proccess is slowed down as I have to be there to click "Allow" everytime. I have read that it is possible to allow programs to enter my Outlook in Trusct Center options but the Windows version is too old and can not fix it this way. Also, as this is a shared server and I have not Administrator access I can not make big changes. I have read other similar questions but nothing in R, like this[Suppress Outlook pop-up allow access or this[How to supress the outlook pop up message while sending mails in PB8. This is my script:

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)
  }
}

Is there any way to embeb a piece of code to avoid this pop-up or to automatically "click" on Allow?

Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343
candelas762
  • 137
  • 3

1 Answers1

0

It looks like you are faced with a standard security prompt in Outlook. There are possible routes where you can go to:

  1. Use a low-level code on which Outlook is based on - Extended MAPI or just any other third-party wrappers around this API such as Redemption.

  2. Use third-party components designed for turning off such security triggers in Outlook - Security Manager for Microsoft Outlook.

  3. Set up a group policy to avoid such triggers.

  4. Set up a valid antivirus software on the system.

Eugene Astafiev
  • 47,483
  • 3
  • 24
  • 45
  • 1
    Thanks for the info. As I work in a shared server I would like to avoid istalling programs or antivirus softwares as they might interfere with others' projects. I think I will try your first reccomendation but I will have to study on it. I am still pretty much a newbie at programming – candelas762 Jun 12 '20 at 15:43