Help with Get Outlook Mail Messages activity

I am unable to get any result once i apply this filter condition - “[SenderEmailAddress] = ‘xyz@abc.com’”, is there any mistake?", there are already emails in my inbox but it doesnt yield any result. Thanks!

Hi @bhanupsharma

In sometimes the filter option in get outlook mail message activity was not working. The expression you have provided is correct but the function is not working properly.

There is other way to check the condition of the mail,
→ Use get outlook mail message activity to retrieve all mails from Outlook it stored all details in List<MailMessage> datatype variable.
→ After get outlook use for each activity to iterate mails in collection variable.
→ Inside for each insert if condition to check the sender mail address, if the condition gets true insert the activities in then block among your process if condition is false it will go to else block.

currentItem.SenderEmailAddress.Equals("xyz@abc.com")

Check the below workflow for better understanding,

Hope it helps!!

Hi @bhanupsharma

We can filter using linq instead, here is the example

(From m In mailMessags
Where m.SenderEmailAddress.Trim().ToLower().Equals("xyz@abc.com")
Select m).ToList()

Regards!

1 Like

Hey @bhanupsharma
Please read this documentation:

Here you will find examples how to use filtering:

1 Like

You can also use SQL query like this:

Thank you for the reply but may i know why this expression does not work - “[SenderEmailAddress] = ‘xyz@abc.com’”

Thanks

Thanks, but still am not getting any result with this expression - “(urn:schemas:httpmail:fromemail LIKE ‘%@gmail.com%’)”

even this expression does not give me any result - “[SenderEmailAddress] = ‘xyz@abc.com’”

but when I try this expression - “[From] = ‘FirstName LastName’” it works.

Thanks

Have you checked this post @bhanupsharma