How to get latest email plus specific subject?

Hi guys. I am a intern at a local company. I am having trouble with my current task now as my colleague use case is when she have lots of email and getting the latest email using Top 1 options with this specific subject like Movie Line-up from… so something is like this:

Outlook email inbox message

  1. Office clean up
  2. Movie Line-up from 2 May
  3. Discipline matter
  4. Movie Line-up from 11 Apr

and so on

So the output must be like 2. Movie Line-up from 2 May and my colleague say using item.ToString.Equals(“Movie Line-up from 2 May”) is wrong but item.ToString.Contains(“Movie Line-up from”) is somewhat correct but how do I get the output that my colleague want.

1 Like

buddy @phoenix123

So the mails willl be always in order like recent first and remaining next to each other right

  1. get outlook mail activity to get the mail messages in collection with onlyunreadmessage and markasread both checked i.e., enabled
  2. inside a for each loop pass this out_mailmessage as input and change the type argument as mailmessage
  3. use a if condition inside the for each loop
    here comes your solution
    in the if condition we will be mentioning like item.subject.contains(" Movie Line-up")
    if this is passing it will go to then part right…?
    so inside the then part we get the details of the mail " 2. Movie Line-up from 2 May"
    as it iterate through the out_mailmessage variable inline
    once after getting the details in then part of if condition we can use Break activity,
    so that once the condition is met and details obtained loop will get over and thus workflow gets over like this, it wont even go for " 3. Discipline matters"

This is reliable, isn’t it, wont miss even a singlemail
no need to mention the top message buddy , it will actually take in sequence only so once the first mail with that subject is found and the details are obtained it will get away from loop as we have bread the very next
the type of out_mailmessage list

Cheers, buddy try this and let know

Kindly make a solution if its getting resolved, as it would definitely help others looking for ideas under you topic

Cheers @phoenix123

So because you know you only want specific subject to include “Movie Line-up from” you can use the filter function by subject with the below format inside the Get Outlook Mail Message activity under options:

"[subject]='Movie Line-up from'"

If you use this alongside returning only the top 1 you will ignore all other emails.

Also ensure you have checked ‘MarkAsRead’ :slight_smile:

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