my requirement is read mail from end of outlook inbox or any folder. but reading email starting point should be last email of list. without using sorting list of email. only read from end of mail folder.
You can filter the emails byt “[ReceivedTime]” I belice to get the oldest one
@Ellboy but i don’t know how to filter. to find last one email
Main.xaml (4.5 KB)
Try this, looks like thr list of mail messages is organised by date anyway, this will give you the last one
@Ellboy not working
Well what’s wrong?
it’s not reading last mail
@samir
I don’t want to pick all or top any number of email. And then reverse or any sorting.
I just want to pick top 1 last email.
-
After reading mails using Get Outlook MailMessage Activity and will give you output as List of mail messages and say mailMessages.
-
Then find the count of it: Int32 mailCount = mailMessages.count
-
To read last mail:
System.Net.MailMessage lastmail = mailMessages(mailCount - 1)
hi @pankajs3
see If mails (List of MailMessage) is your output variable of Get Outlook Mail Message.
Then,
- If you want the latest then, mails.First
- If you want the oldest one then, mails.Last —> this is (System.Net.Mail.MailMessage)
so you can apply anything related to System.Net.Mail.MailMessage object,
e.g. mails.Last.Subject.toString OR mails.Last.From.toString.
I am reading only one mail.
i am not reading multiple mails.
So i want i read one mail, that should be last mail
You want to read particular day last mail or want to read last mail from entire mail box.
@lakshman
partially correct.
i want pick only one last email.
Have tried the steps mentioned in above post or not ?
Hello @pankajs3
Check this workflow for better understanding This’ll get you the last email
Mail.xaml (6.8 KB)
Those steps are firstly reading multiple emails then getting last email. But my requirement is not that.
Hello @pankajs3
what exactly is your requirment ?
To read mails from outlook, we have to use Get Outlook MailMessage Activity and output is list of mail Messages. Then we are trying to read last mail from that but we are not processing all mails.
Do one thing if you know the subject of the mail then specify it in Filter option. It will read that particular mail only.