cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Gforse
New Member

Create filename with datetime

Dear,

I'm very new to Flow and I'm failing to get the UTC date time in a new filename.

My flow works as follow, if an email arrives with an attachment, then save this attachment in OneDrive. So far so good everything works. However now for the difficult part I want to create a new file name. Like yyyyMM_something.pdf

I've tried concat and formatdatetime functions but those doesn't seem to work, or I'm using them the wrong way.

Hopefully someone could help me out.
3 REPLIES 3
v-xida-msft
Community Support
Community Support

Hi @Gforse,

 

Could you please share a screenshot of your flow’s configuration?

Further, how many attachment files does the incoming email have?

I have made a test on my side and please take a try with the following workaround:

  • Add “When a new email arrives” trigger.
  • Add a “Apply to each”, Input parameter set to output of above trigger.
  • Within “Apply to each”, Add a “Compose” action, Inputs set to dynamic Name content (Attachment Name).
  • Add a “Compose 2” action, Inputs set to following formula:
concat(utcNow('yyyyMM'),'_',outputs('Compose'))
  • Add “Create file” action, File name set to output of “Compose 2” action, File content set to dynamic Content value (Attachment content).

Image reference:11.JPG

The flow works successfully as below:12.JPG

 

13.JPG

 

Best regards,

Kris

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Dear Kris,

 

Thanks for the explanation, it works like a charm! 🙂

 

I was trying to use the concat function in the "create file" action. Didn't know we first had to use the compose action. Now everything is working as i hoped, thanks again!

 

Have a nice day.

I am receiving a message from the service bus queue and performing some sort of operations. I have used if-else conditions, so if it's true then I am creating an azure file. Until now everything works. But I need to add an <name_timestamp> in the filename. But I unable to do so whenever I use UTC expressions as the filename doesn't take special characters.

 

I tried utcnow('D') expression but it only shows date, but I actually need date and time, in timestamp format. Is there any way to achieve the same?

 

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Difinity Conference 2022

Difinity Conference 2022

Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.

European SharePoint Conference

European SharePoint Conference

The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Users online (1,537)