1

Newbie here, need to get a DateTime value for when each email was originally received.

EDIT: Added code. I have the item, I am just trying to get the time received but I cannot find the property for it.

            foreach (MailItem item in mailItems)
            {
                emailDetails = new OutlookEmails
                {
                    EmailFrom = item.SenderEmailAddress,
                    EmailSubject = item.Subject,
                    EmailBody = item.Body

                };
                listEmailDetails.Add(emailDetails);
                ReleaseComObject(item);
            }
David Andrew Thorpe
  • 838
  • 1
  • 9
  • 23
  • 3
    According the the MS documentation, each MailItem has a ReceivedTime on it. https://learn.microsoft.com/en-us/dotnet/api/microsoft.office.interop.outlook._mailitem.receivedtime?view=outlook-pia – user1011627 Feb 05 '19 at 16:42
  • 1
    Do you just need help identifying the right MAPI property, or do you need help reading it? Do you already have the IMailItem? – Rup Feb 05 '19 at 16:43
  • Hey, added a snippet of code where I am trying to get the received time. I have the item, I just can't figure out how to get the received time from it – David Andrew Thorpe Feb 05 '19 at 16:54
  • item.receivedTime is the answer! Cheers guys – David Andrew Thorpe Feb 05 '19 at 16:56

1 Answers1

1

item.ReceivedTime is the answer.

Credit to: user1011627

David Andrew Thorpe
  • 838
  • 1
  • 9
  • 23