2

I am trying to query Outlook Contacts and extract them all in a csv file using R programming language. I have a example piece of code:

#####################################################
library(RDCOMClient)
## init com api
OutApp <- COMCreate("Outlook.Application")
olFolderContacts <- 10

# get the namespace
ns <- OutApp$GetNamespace("MAPI")
# get the contact folder
folderContacts = ns$GetDefaultFolder(olFolderContacts)
# get the contact list
folderItems = folderContacts$Items()
i = 0
# get the first contact
itemObj = folderItems$Item(i+1)
#####################################################
# That's here that it fails
#####################################################
ContactName <- itemObj$GetElement()$Name()
#####################################################

The idea is that the folder contains items which are of different type. How to query the Object COM interface to get the object type or Class and how to invoke the methods related to it?

Thanks,

Maurizio.

CatalystRPA
  • 1,782
  • 1
  • 9
  • 18
MNapoli
  • 21
  • 4

0 Answers0