How to filter messages in Get outlook mail messages with .txt attachments?

Hi,

I need use the filter from Get Outlook Mail Messages to retriver just the emails that have .txt. Can you help with this? It’s something like this but that is something wrong…
“[Attachments]=‘.txt’”

1 Like

Filter works with the mail headers like subject, sender, received date etc.,

In your case, you have to read mail messages and check for the below condition -

If(mail.attachment.Name.EndWith(".txt"))

Regards,
Karthik Byggari

1 Like

buddy you can check only the mail has any attachment or not with outlook filter in case of ATTACHMENTS and we cannot filter the mail based on the attachment file and its extension with filter property in get outlook mail activity
rather we got another idea to deal with
–just get the list mail messages from get outlook mail activity and store it to a variable of type mail message collections
–then use a for each loop and pass the above obtained variable and change the type argument as mailmessage in for each loop
–Inside the loop use a if activity to get the attachment name like this
attachmentName = CType(item.Attachments.FirstOrDefault, Attachment).Name
if this condition gets passed it will go to the THEN part of the if condition or will go to the ELSE part of if conditon where you can keep your activities you need
Cheers @ac_couto6

2 Likes

Tks…

Can you show me an example? I tried and get wrong…

1 Like

Fine
one small correction just now i made
to find the name of the attachment we must use
attachmentName = CType(item.Attachments.FirstOrDefault, Attachment).Name
not
item.attachment.name.Contains(“txt”)

hope that must be throwing error on yours
kindly try and let know buddy
or share your xaml so that would be easy to debug
Cheers @ac_couto6

Can i get the attachment txt of the email without saving it ? and find some value from it ?

As per my knowledge, not possible to read the text without saving the attachment.

Regards,
Karthik Byggari