Hello Everyone, I’m a beginner in UI Path and I have been trying my hands on Email Automation. While Practising outlook automation I came across Save Attachment Activity. I was just curious if there is a way to determine if there is/are any attachment(s) in the mail. Or if there is a way to fire a message to sender if in case there is no attachment in the mail.
Yes it will check System.Net.Mail.AttachmentCollection(Item is here a System.Net.Mail message) is having any attachment or not and with .Any() will return the output in boolean like true or false so i am using it directly inside if condition. You can use count as well to get the attachment collection counts and make your own conditions to proceed further.
would you happen to know how to check if the email has excel attachments, so specific attachments?
In my process, someone could email with just an excel attachment, or three attachments, one of which is excel, or multiple attachments, none of which are excel etc.
If there is no excel attachment in the email (even if it has multiple different attachments, as per the examples above) I need to respond saying “invalid email” (ie I have to check each email for an excel attachment, I cant use the filter in the get outlook mail messages activity, as I need to respond to every email).
In my if condition I tried using:
item.Attachments.ToString.Contains(“.xlsx”)
I tested this on an email with an excel attachment, but it failed, showing a message box i put in place saying “no excel attachment” lol