Type of reusable component:
I need to send mail by adding attachment which are present in folder.
First, I need to read data from one folder there I get attachment filename with extension and then I need to search in Attachments folder whether the file exists or not. If Exists I need to attach that attachment and send mail.
**Main.xaml (9.7 KB)
** I need to search weather the file exists in folder with passing the file extension (.pdf, .doc, .docx).
string files = System.IO.Directory.GetFiles(path, "filename.*");
if (files.Length > 0)
I have tried but it didn’t worked can you please update my solution and post it.
Did you got any error ?
I don’t see any issue with the code.
can you try hard coding the values of path and file name and check.
If it works, then you are passing the wrong values in the variables.
Hey Thank you for your support. It works fine. @KarthikByggari
Hi @KarthikByggari here you have mentioned the finename, but we don’t know the file name we’re just checking it right,
so we can give like this also na “*.extension” . Right me if I am wrong.
I given the assigned like this to the array file variable.
But I have multiple extension files, So how to give the extension.
You can mention multiple extensions like below -
string files = System.IO.Directory.GetFiles(path, “*.extension1, *.extension2”)
Thanks Bro really helpful