Hello everyone,
I need to retrieve only the 1 oldest email in the folder using the “GetOutlookMailMessage” activity. Is it possible to do it?
Thank you very much for your help!
Regards
John
Hello everyone,
I need to retrieve only the 1 oldest email in the folder using the “GetOutlookMailMessage” activity. Is it possible to do it?
Thank you very much for your help!
Regards
John
i dont think we can do this with existing activity, you can try below steps if volume is not high
after reading outlook Emails, use invoke Code with argument in/Out and write listOfMailmessageVariableName.Reverse
this will turn your oldest email on top
NOTE: this would work only if you mention the total emails, if email count is very high BOT would through the error.
You can try the following code
OldestEmail = MailMessageList.AsEnumerable().OrderBy(Function(msg) msg.Headers("Date")).First()
You can replace the Date
in the query with DateCreated
or DateReceived
properties and see if it solves your problem.
As @Gurram_Akhil mentioned, this should not be used when no of messages is huge.