考虑Outlook的
Stores
OutApp <- COMCreate("Outlook.Application")
OutStores <- OutApp$Session()$Stores()
# 1ST ACCOUNT
myfolder <- OutStores[[1]]$GetRootFolder()$folders(folderName)
# 2ND ACCOUNT
myfolder <- OutStores[[2]]$GetRootFolder()$folders(folderName)
...
甚至在所有商店中循环:
OutApp <- COMCreate("Outlook.Application")
OutStores <- OutApp$Session()$Stores()
store_count <- OutStores$Count()
for (i in 1:store_count) {
myfolder <- OutStores[[i]]$GetRootFolder()$folders(folderName)
emails <- myfolder$Items
for (i in 1:10) {
subject <- emails(i)$Subject()
print(subject)
}
}
# QUIT APPLICATION
OutApp$Quit()
# RELEASE COM RESOURCES
subject <- NULL; emails <- NULL; myfolder <- NULL
OutStores <- NULL; OutApp <- NULL
gc()