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