How to filter the outlook mails using IF condition without using For each loop

Can we filter the outlook mails using IF condition without using For each loop.?? Please help

Hey @khan,
That depends on the condition you want to apply!

Okā€¦ I agreed Rishab. I want to filter my mail by subject. but to work with IF condition ā€œFor eachā€ is required. My question isā€¦ is there any way, that I can use IF condition without For Each. I need to use like thisā€¦ item.subject.contains(ā€œSomethingā€)ā€¦ Kindly suggestā€¦ I dont want to run the loop. Aur loop is running, so I want to stop the loop once condition will fulfill.

To go through the complete list you will have to use a loop!
Although, as you want to stop once the condition is fulfilled, just place a break activity in the ā€˜thenā€™ clause of if activity
So when your condition is met you can take the necessary action and then immediately break out of the loop without having to go through the other items.

1 Like

Thanks Rishabhā€¦ Let me try thisā€¦ Hope it will work

It will for sure :slight_smile:

How to read a single outlook mail at a time for a specific keyword?? How to filter or read single mail id from outlook. If I am using FOR EACH. I donā€™t want to iterate that much time , how much mails are available. Based on my condition, I want to read only single mail and want to stop . If more than one mails are available then how to read only particular mail at first only. Kindly suggest