This tutorial describes that how we can read the email from outlook and sort the email list into ascending or descending order.
Reading the email from the outlook
- Use Get outlook mail message activity
- In the Account property pass the email account from which account we are trying to read the email, if we will leave this field blank it will read the email from the default account.
Once we will get this email into list and we want to sort it, let see how we can do it.
- Convert ListOfMailMessage To AscendingOder
(From email In ListOfMailMessage Order By email.Headers(“Date”)).ToList
- Convert ListOfMailMessage To DescendingOrder
ListOfMailMessage.OrderByDescending(Function(mail) mail.Headers(“Date”).ToString).ToList
Some Mail Message Header list is given below:-
- Bcc
- Cc
- Content-ID
- Content-Location
- Content-Transfer-Encoding
- Content-Type
- Date
- From
- Importance
- MIME-Version
- Priority
- Reply-To
- Sender
- To
- X-Priority
I hope you enjoyed this article.