Send Outlook mail with one PDF attachement

Hi all,

We are trying to send an Email using (Send Outlook Mail Message) however we want to attach one PDF file in a file with Thousands of other PDFs

How do we only select the file we wish to attach

use FOR each.
item in directory.GetFiles(“your path name”)

use if condition

Path.GetExtension(item).Contains(“your pdf name”)

We Get this Error,

Strict on disallows conversation between object and string.

Hi there …

sorry i though you were seaching for pdf files from other files

use FOR each.
item in directory.GetFiles(“your path name”)

use if condition

(item).Contains(“your pdf name with extension”)

or

path.getfilename(item).contains(“your pdf name with extension”)

1 Like

You can do like this:
MyFiles = Directory.GetFiles(“c:\myfolder”, “PDF Extract*”)
And in Send OutLook Mail Message in AttachmentsCollection you put the result of MyFiles variable.

2 Likes