Get extention of attachement

I’m trying to get the extention of each attachement in an outlookmessage to check if it’s an pdf or not.
I’m trying to use a for each to loop the attachement and then an if with following condition
Path.GetExtention("attachemnt).Equals(".PDF") Or Path.GetExtention("attachemnt).Equals(".pdf")
But it returns an empty string…

Could you please try the below code

Path.GetExtension(attachmnt.Name).Contains(“pdf”)

Thanks,

Pradeep Sridharan

Hi
hope this condition would help you resolve this
in IF condition like this
Path.GetExtension(attachment.name).ToString.ToUpper.Equals(“PDF”)

make sure that if we are iterating through attachment collection then this is fine else if we are iterating through mails then we need to mention like this
Path.GetExtension(item.attachment.name).ToString.ToUpper.Equals(“PDF”)
where item is a variable from FOR EACH activity with type argument as System.Net.Mail.Mailmessage in the property panel of FOR EACH with mailmessage list as input in it

Cheers @Daniel_D

Thanks for the tips guys, but I thought I could do it in an otherway, I need to check the emailattechements for images, so if it’s an image I just save it and when it’s an pdf I should extract the images and then save it. So instead of looping the attachements and then using an if, I thought I could use a filter, first I do a save attachelnts with a filter for all the imageextensions and save it fdirectly to the directory (that seems to work) and then I was tryong to do the same for the pdf extension, but instead of saving to the directory I wanted to save it to a list to itterate and extract the images, but I’m not shure which datatype this list should have, there’s no such thing as an array of Attachements is there?

apperently the filter dosn’t work, I tried to put the count of the list in a messagebox and Got 0

Lol nevermind, I didn’t notice that instead of (“.PDF|.pdf”) i entered (“.PDF|.pdfList”) as filter, now it works as expected