Get the oldest email - Get Outlook Mail Message

Hello everyone,

please can you advise me how to get the oldest email with getOutlookMailMessage activity?

Thanks a lot
John

Hi,
Go to ManagePackages->Select ‘All Packages’ and search ‘UiPath.Mail.Activities’
Refer the below link about Mail activites

Hi,

Unfortunately, I didnt find what I was looking for there. I only need to retrieve one of the oldest emails. Can anyone help me?

Thanks a lot

You just referred the OP to the documentation for the activity they are already using which doesn’t explain how to get the oldest email first. I am also looking for that solution.

Do you have a solution for getting the oldest email first?

Thanks.

Once you retrieve a list of mail messages using the Get Outlook Mail Message activity, you can sort them in reverse using the following query:

mailMessages = mailMessages.OrderBy(Function(x) DateTime.Parse(x.Headers("Date").ToString)).ToList 

This query has been addressed before. See: Get Outlook Mail Message - Oldest First