web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Formatting File Name f...
Power Automate
Unanswered

Formatting File Name from Attachment

(0) ShareShare
ReportReport
Posted on by

My programming skills have gotten rusty, so I can't figure out how to do this.

 

I'm doing a pretty standard Flow to save attachments sent to an email address in Onedrive. I would like for the name of the file to be NameofSender_EmailSubject_Date.pdf. The name of sender would be the local part of the email address (ie everything before the @ symbol), and the Date I would like formatted such that April 15, 2010 would be 41510.

 

I assume I need to initialize some variables to pull this information from the email as a string, but I can't figure out how to format into the form I want. Any help would be appreaciated.

Categories:
I have the same question (0)
  • ScottShearer Profile Picture
    25,270 Most Valuable Professional on at

    Here is one solution to your issue.  I assumed that the files were not PDF files coming in and needed to be converted.  I also assumed that there could be more than one attachment.  If those assumptions were in error, you can pull the steps associated with those concepts out of the Flow.

     

    I use a variable to store the name part of the email address using the following expression:

    substring(triggerBody()?['From'],0,indexOf(triggerBody()?['From'],'@'))
     
    I use a variable to store the date portion of the file name using the following expression:
    formatDateTime(triggerBody()?['DateTimeReceived'],'MMddyy')
     
    I use a third variable as a counter that I can increment to use in the file name in order to account for multiple attachments.
     
    If this isn't what you need please post here and I will adjust my Flow.  If it is what you need, please post that also.
     
    PDF1.jpgPDF2.jpgPDF3.jpgPDF4.jpgPDF5.jpgPDF6.jpg
     
     

     

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 519 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 296 Moderator

#3
abm abm Profile Picture

abm abm 232 Most Valuable Professional

Last 30 days Overall leaderboard