Get Outlook message Filter email

Dears,
I am using get Outlook Mail Message, I need to filter the email which is contain an excel sheet only… any idea how to do the same.

Thanks in advance

@mosa_sleeman,

You can use For each activity,

For each mail(must be type of system.net.mail.mailmessage) in MailMessage{
if mail.subject.contains(“abc”){
// do something
}Else{
// do something else
}
}

this way you can filter out emails

I need to filter if the email has an attachments with excel format

Hi,

hope this will help to resolve the issue

Try using below expression in filter property

“[attachment]=’.xls’ OR [attachment]=’.xlsx’”

Refer here for more help : Chapter 11: Searching Outlook Data | Microsoft Learn

1 Like

Thanks For your replay,
it’s given me as below
image

Try removing the spaces

“[attachment]=’.xls’ OR [attachment]=’.xlsx’”

Well done, thanks

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.