Hello, i need to send and email with and attachment i have assigned the source file to a variable and add the attachment argument the variable that has been assigned to the source folder.
but i get this error massage.
If you wanted to attach a single file then you can use the above process and give the full path including the file name and if you want to add multiple files then please add them to the list variable and pass that variable in the image shown below:
You can get the latest file in the folder using below linq query:
Directory.GetFiles("YourFolderPath").Where(Function(file) Path.GetExtension(file).Equals(".pdf",StringComparison.OrdinalIgnoreCase)).OrderByDescending(Function(file) New FileInfo(file).LastWriteTime).FirstOrDefault()
Replace YourFolderPath with the actual folder path.
Yes the workflow provided above will attach only the latest file. Please make sure to keep the order by as Last Updated date newest first. This will help to attach the latest updated file.