0
votes

I am trying to extract email date from my Lotus Notes Inbox folder. I am able to get the From, To, Subject and Body of the email. I tried using "DeliveredDate" and "PostedDate" attributes but no luck.

My code looks like this:

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
1
This code seams to be correct. Do you get an error message? - Torsten Link
I do not see any error message, I just get a NULL value for the date. - Rohith
Are you getting that for all documents? Or just the first that happens to come up? Since the Inbox is a folder, not a view, you can have many kinds of documents in there, and some of them may not have a DeliveredDate. You should be using an 'if doc.HasItem("DeliveredDate")' construct to check that. (Also for Subject, From, and Body...) - Richard Schwartz
I get a NULL for all the records even though they have a delivered date. - Rohith

1 Answers

-1
votes

Try With:

doc.GetFirstItem("PostedDate").Text