如何使用 RDCOMClient 按日期检索电子邮件

How to retrieve emails by date using RDCOMClient

我正在尝试仅检索从我的 Outlook 收件箱中的特定文件夹收到的 "today" 电子邮件。我怎么能做到这一点?下面的代码允许我从收件箱中提取所有电子邮件,但我只对今天收到的电子邮件感兴趣。我要在我的代码中添加什么?

folderName <-  "Folder2"

## create outlook object
OutApp <- COMCreate("Outlook.Application")
outlookNameSpace <-  OutApp$GetNameSpace("MAPI")

folder <- outlookNameSpace$GetDefaultFolder(6)
fld <-  folder$folders(folderName)
cnt <-  fld$Items()$Count()

emails <- fld$items
resp <-  data.frame(sno = 1:cnt,Text = "",stringsAsFactors=FALSE)

for(i in seq(cnt)){
  d <-  as.data.frame(emails(i)$Body(), stringsAsFactors=FALSE)
  resp$Text[i] = d[1]
  resp$Sender[i] = emails(i)[['SenderName']]
  resp$To[i] = emails(i)[['To']]
  resp$sub[i] = emails(i)[['subject']]
}

Items.Find/FindNextItems.Restrict 与类似 [ReceivedTime] >= '02/20/2020 00:00am'

的查询一起使用