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?