-->

RDCOMClient + Outlook email search using date in R

2019-09-03 03:56发布

问题:

I am trying to search emails in the mail using RDCOM client in r.

i am not able to search the mails using date as filter.

I am getting all the mails present in my inbox when i use the code below

library(RDCOMClient)

outlook_app <- COMCreate("Outlook.Application")
search<-outlook_app$AdvancedSearch("Inbox","urn:schemas:mailheader:date = '2018-08-22 00:14:10 IST'")
results <- search$Results()
results$Count()

I tried searching for any good documentation on how to do it but i could not find any resource.

Can Anyone help me with this?

回答1:

You should never use "=" when working with dates: you can never get an exact match because of the round-off errors. Always use a range (prop > date1) and (prop < date2).