Is there anyway to filter emails based on attachment name?
I am using get outlook mail message activity and I want to filter based on subject, sender email and attachment name. I am able to do it on subject and sender email but how can i filter based on attachment name?
My actual requirement is that i should only get those emails which are sent specifically by ‘Sender A’ containing ‘Subject A’ and also containing ‘Attachment A’. If it contains ‘Attachment B’ then this email should not be considered.
myMailMessages - the output from get outlook mail message activity
Assign Activity:
myFilteredMails | Array of MailMessages =
(From m In myMailMessages
Where m.Subject.Contains("MySubjectFilter")
Where m.Sender.Address.Equals("MySenderFilter")
Where m.Attachments.Any(Function (x) x.Name.Contains("MyAFilter"))
Where Not m.Attachments.Any(Function (y) y.Name.Contains("MyBFilter"))
Select fm = m).toArray
we can also combine the direct filtering on sender, subject and then do a post processing with the modified LINQ statement from above