Sending attachment problem

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.


also this is the configuration for the assign activity

and the configuration for the attached file.

thanks

HI @mohamed.saty2012

Will there be multiple pdf’s in the folder or else a single file?

Regards

Hi @mohamed.saty2012

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:

Regards

Hi @mohamed.saty2012 ,

Check with full path

image

Thanks,

the file name will be different every time so i cant write the file name.
that is why i writhe *.pdf.

1 Like

Hi @mohamed.saty2012

Everytime will the folder contain only single file ?

Regards

for this phase yes it will have a single file

HI @mohamed.saty2012

check the below workflow:

By using the above workflow the bot will take the latest file and will break the loop after it send’s the Mail with the attached file.

Regards

Hi @mohamed.saty2012

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.

Regards

Thank you. the for each activity solved it and i can depend on it in the coming updates if there is multiple files

Hi @mohamed.saty2012

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.

Regards

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.