Forum Discussion
Rob Bowman
Dec 29, 2017Iron Contributor
Concat "Todays Date" for File Name - Save Attachment - Help
All,
Can anyone give me some quick tips or is it even possible.
Scenario:
Report to a mailbox comes everyday, named the same.
Want to remove the report from the email, save it to a Sh...
Damien_Rosario
Mar 23, 2021Silver Contributor
Hi ARadtke
Don't forget to add .pdf to the back of the filename if you haven't already done so.
Cheers
Damien
Justin_Gangl
Mar 26, 2021Copper Contributor
Hi Damien_Rosario ,
I'm having the same issue with my attachment filename. I have 2 files with the same name coming into a mailbox as attachments, one is a .pdf and the other is a .xlsx. I want to remove the files from the email, and save them to a SharePoint library with today's date/time added to the filename.
Current attachment filenames:
attachmentname.pdf
attachmentname.xlsx
Desired attachment filenames in SPOL:
attachmentname_03-26-2021-2-10-PM.pdf
attachmentname_03-26-2021-2-10-PM.xlsx
In my Create File action, in the File Name field, I've tried using 'Attachments Name'_'Received Time' dynamic content dialogue.
That appends the date after the file extension, attachmentname.pdf_03-26-2021-2-10-PM, giving an unknown filetype.
If I add .pdf in the File Name,
then I get a usable filename, attachmentname.pdf_03-26-2021-2-10-PM.pdf, but it obviously changes my xlsx file to a pdf extension as well.
Any thoughts on how to accomplish this? Appreciate any help you can provide.
- Damien_RosarioMar 28, 2021Silver Contributor
Hi Justin_Gangl
Rob's solution covers a solution pretty well in the order you want to see it in.
Alternatively, you could put the received date at the front of the name followed by the file name. This way the extension will always work and will require no additional actions.
Cheers and best wishes
Damien
- Justin_GanglMar 29, 2021Copper Contributor
- RobElliottMar 27, 2021Silver Contributor
Justin_Gangl you can do this if you split the attachment name on the .dot. You need several Compose controls as shown below:
Rob
Los Gallardos
Microsoft Power Automate Community Super User.
If I've answered your question or solved your problem, please mark this question as answered. This helps others who have the same question find a solution quickly via the forum search. If you liked my response, please consider giving it a thumbs up. Thanks.- anandsreekumarNov 05, 2021Copper Contributor
Hello , Have used the formatdatetime('utcnow()', 'g) and added a connection to convert time zone to Eastern Standard time. While pulling in this to my file name, the format of output is coming as <filename>_MM_DD_HH HH_MM AM. I would like to get this in following format <filename>_MM/DD/HH HH:MM AM
Any Leads. Thank You !!!
- Justin_GanglMar 29, 2021Copper ContributorRobElliott
Perfect! This solves my issue. Thanks so much!