Filter mail messages based on body

Hi,

I’d like to get only the messages where the body contains word “January”. Tried with something like this:
“@SQL=urn:schemas:httpmail:textdescription like ‘%January%’”
but it does not work.

Could You help me how to make such filter in GetOutlookMailMessages activity?

Best Regards

Hi @wenar58700

Check the thread below Similar reference!

Regards

Hi,

I checked it and used it the same way I think. That topic is closed so I created a new one.

Or maybe I did some error, can You help me?

Hi @wenar58700

we can try with another method also!

After using Get Outlook mail message

Use For each and change the type argument to Mail message

use If condition and express Item.body.Tostring.Contains(“January”)

Then part you will get all the mail message body that contains Body with January!

Regards

1 Like

Hi,

actually in this email I get like 3000 emails daily and I do not really want to loop through all of them :frowning:

Hi @wenar58700

Is that any error You re getting while using the Format Mentioned in the Post 1?

Regards

Hi @wenar58700

Please use the below code inside your loop (for each item)

Either use item.Subject.Contains(“January”) or item.Subject Like “January*”

Hope this will help you. Thank you.

@wenar58700 Please visit the official documentation of the activity. It provides two examples of how you can search for a string in an email body. This is the link: Get Outlook Mail Messages

1 Like

One thing regarding this. I had similar task, 2000 users and around 1000 emails. The solution was developed using ReFramework.
You could get all the emails without filter once, and then using LINQ you can filter out those emails.
This saves a lot of time and it will help if outlook or mail server is slow