首页 > 解决方案 > 使用 R 提取 Outlook 联系人

问题描述

我正在尝试使用 R 编程语言查询 Outlook 联系人并将它们全部提取到 csv 文件中。我有一个示例代码:

#####################################################
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()
#####################################################

这个想法是该文件夹包含不同类型的项目。如何查询 Object COM 接口以获取对象类型或 Class 以及如何调用与之相关的方法?

谢谢,

毛里齐奥。

标签: routlookrdcomclient

解决方案


推荐阅读