Can't receive new emails with RDCOMClient

Occasional Contributor

I'm trying to use R to load my emails from Outlook 365. Yesterday I tried this:

library(RDCOMClient)
outlook_app <- COMCreate("Outlook.Application", existing = FALSE)
outlookNameSpace <- outlook_app$GetNameSpace("MAPI")
folder <- outlookNameSpace$GetDefaultFolder(6)
emails <- folder$Items
and it worked fine. When I ran the following code:

emails(1)[['Subject']]
I could see the subject of the last email on my Inbox. Great!

However, I couldn't get any updates from that point. If I run the same code today, I get exactly the same emails than yesterday, eventhough I have new emails on my Inbox.

I tryed with and without the existing = FALSE option in COMCreate function, but with no success.

What I'm doing wrong? How can update the data with the new emails?

By the way, is there any good documentation or tutorial about using RDCOMClient with Outlook? I still can't get the logic of this library.

Thanks!

0 Replies