【问题标题】:Extract email date from lotus notes email to ms access using vba使用 vba 从 lotus notes 电子邮件中提取电子邮件日期到 ms 访问
【发布时间】:2018-01-31 18:48:40
【问题描述】:

我正在尝试从我的 Lotus Notes 收件箱文件夹中提取电子邮件日期。我能够获取电子邮件的发件人、收件人、主题和正文。我尝试使用“DeliveredDate”和“PostedDate”属性,但没有运气。

我的代码如下所示:

Set db = objNotesSession.GetDatabase(mailServer, mailFile, False)
Set folder = db.GetView("Inbox")
Set doc = folder.GetFirstDocument
Do Until doc Is Nothing

  Set docNext = folder.GetNextDocument(doc)
  msgTo = doc.sendto
  For Each recipient In msgTo
    recipients = recipients & recipient
  Next
  msgFrom = doc.GetItemValue("From")(0)
  msgSubject = doc.GetItemValue("Subject")(0)
  msgBody = doc.GetItemValue("Body")(0)
  msgDate = doc.GetItemValue("DeliveredDate")(0)
  Set doc = docNext
Loop

【问题讨论】:

  • 这段代码看起来是正确的。您收到错误消息吗?
  • 我没有看到任何错误消息,我只是得到一个 NULL 日期值。
  • 您是否为所有文档获取该信息?还是只是碰巧出现的第一个?由于收件箱是一个文件夹,而不是视图,因此您可以在其中包含多种文档,其中一些可能没有 DeliveredDate。您应该使用 'if doc.HasItem("DeliveredDate")' 构造来检查它。 (也适用于主题、发件人和正文...)
  • 我得到所有记录的 NULL,即使它们有一个交付日期。

标签: vba ms-access lotus-notes


【解决方案1】:

尝试:

doc.GetFirstItem("PostedDate").Text

【讨论】:

    猜你喜欢
    • 2022-01-15
    • 1970-01-01
    • 2017-12-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多