How to remove from list<MailMessage> mail messages

In my project, i use activity Get IMAP mail message (top: 10) and generate output veriable list, then using Move IMAP mail message activity I want to move one message from the collection to a imap folder, and I do it with the expression: listMailMessage(listMailMessage.Count - 1).
But not the earliest mail message by date is moved from the collection. My task: move the earliest mail message from the collection to a imap folder using the Move IMAP Mail Message activity. Can I filter with the Headers(“Date”) method the mail messages in the collection? Or is there another way? Thanks.

Welcome to uipath community
We can sort the email with the date

Once after sorting use move impact mail activity and mention like this
outmailmessage(0) as a input for mailmessage property so the first one will be moved to the folder we have specified
Where outmailmessage is a output variable that we have obtained from Get IMAP Mail Activity

Cheers @Foertsch

Thanks a lot! It helped! I am very grateful to you!

Cheers @Foertsch

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.