Attach a dynamic filename to outlook mail activity

Hello I’m building a bot that can attach a file and send it it via Outlook mail activity. But I’m having a problem with that… it shows that the file is not existed. can you help me with this one. thanks a lot.


Welcome to the community

Can you show the path?

Did you give relative path if so can you give fullpath there please and try


Well the path will be the folders that I made… and inside that all the pdf files that has different names… I dont have a problem accessing the folders… but I do have problem attaching a certain file name… like for example inside the folder there are 3 files… a.pdf, b.pdf, and c.pdf. The thing is I want to attach the file dynamically. like I can attach a.pdf or b.pdf without hard coded it by simply relying to my input

Hi @John_Aquino ,

You can try zipping the folder containing the files and giving the path of the zipped folder in attachment.


no there are different file name in the folder I just need to attach the file (with specific name) based on my input… so the bot will look up to that file in the folder and attach it in outlook mail activity


You can use attachment collection option…

For getting the required file as a collection use directory.getfiles("Folderpath",varfilename)

Varfilename is the filename you want to fetch dynamically…if you want to loop through each file then use for each file in folder and in attachment collection give {currentfile.fullname}

Ypu can give the output of this to attachment collection

Hi @John_Aquino

Can you troubleshoot the issue by following these steps-

  1. Make sure that the file you are trying to attach actually exists at the location you have specified. Check the file path for any spelling errors or typos.
  2. Ensure that the file has the necessary permissions for the user account to access the file.
  3. Instead of using a relative file path, try using a fully qualified file path that includes the drive letter and the full path to the file.