Filter a Get Outlook Mail Messages depending on attachments

I need to get the unread Outlook mails, using the filter of the Get Outlook Mail Messages activity, in order to only get the ones with attachments. This must be filtered using the activity, not filtering after I get the message, because the mails without attachments must not be marked as read, only the ones with attachments.

Right now, my filter string looks like this:

“[From]='”+Name+“’ AND [hasattachments]=‘Yes’”

But it says that the “hasattachments” property is unknown. How is called this property?

PD: In fact, the Outlook application is in Spanish, so the real string is:

“[De]='”+Name+“’ Y [tienedatosadjuntnos]=‘sí’”

So, if you know the property name in Spanish, it would be even better for me.

1 Like

This should work, tested in Outlook 2010.

"@SQL= urn:schemas:httpmail:sendername='Name' AND urn:schemas:httpmail:hasattachment=true"


This is good info, cause it’s slow getting all emails then filtering afterward. But, what I’m wondering is if you have a table or list of senders, how well would it work to query the list into the filter parameter?

for example:

"@SQL= "+String.Join(" OR ",(From s In senders.AsEnumerable Select "urn:schemas:httpmail:sendername='"+s(0).ToString+"'").ToArray)

I have not tried this, yet.

EDIT: Additionally, I looked up the field names here after vvaidya’s posts on this: urn:schemas:httpmail: Namespace | Microsoft Learn


It should work. For fetching the emails based on Email Address, this works not the httpmail.

"@SQL="+Chr(34)+""+Chr(34)+" like '%Part of email%'"

"@SQL="+Chr(34)+""+Chr(34)+" ='Email Address'"

Hello @vvaidya, thank you for your information.

I tried your code (for fetching emails based on Email Adrress),
but the first one returned me some mails containing the specified Email Address (whether it is in To, or CC),
and the second one always returned me nothing.

I need to filter the emails only from a certain email address (Sender’s email address), do you have some suggestion on this?

1 Like