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
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)
see If mails (List of MailMessage) is your output variable of Get Outlook Mail Message.
- 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.
i want pick only one last email.
Have tried the steps mentioned in above post or not ?
Those steps are firstly reading multiple emails then getting last email. But my requirement is not that.
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.