StudioX send email activity attaching a file with dynamic name

I have a send email activity where I want to attach a file with a dynamic name. The file name changes every time I run the flow, and this is intentional, because I need the file name to include the month and year. How do I attach the file to the email if the file name is different every time?


Try below expression to find dynamic filename.

      Directory.GetFiles("Folder Path","*"+Now.Month+"*"+Now.Year+"*")(0)

Hi @lakshman

If my file is located here: C:\Users\jibroni\OneDrive\Desktop
And my file name is: SFDC Data Uploader Registered Attendees
And file is .xlsx

What would the proper expression configuration be?
I tried
Directory.GetFiles(“C:\Users\jibroni\OneDrive\Desktop”,“SFDC Data Uploader Registered Attendees “+Now.Month+”*”+Now.Year+".xlsx")(0)

But it didnt work. Also, do i add the expression to the Advanced Editor? I am very new to StudioX, so I appreciate your help.