I have several inboxes in Outlook: my.name@abc.com, plus a number of shared inboxes like team.data@abc.com for example, or team.ba@abc.com.
By following this method I am trying to access the emails in my own inbox.
The problem is that sometimes, the inbox accesses mails to my.name@abc.com, sometimes it can be any of the others! I've gone through the Omegahat explanations, but their example is mostly focused on excel, and I have no VB experience.
I would like to define which inbox to retrieve the mails from.. My code so far (with the problem of varying inboxes). Cheers.
OutApp <- COMCreate("Outlook.Application")
outlookNameSpace = OutApp$GetNameSpace("MAPI")
folder <- outlookNameSpace$Folders(1)$Folders(folderName)
folder$Name(1)
emails <- folder$Items
for (i in 1:10)
{
subject <- emails(i)$Subject(1)
print(emails(i)$Subject())
}
edit: I am running MSOffice Pro Plus 2016
related: How to use RDCOMClient to send Outlook email from a secondary account - translate existing VBA code?