Skip to main content
Community site session details

Community site session details

Session Id :
Power Automate - Building Flows
Answered

Building flow to save file in sharepoint under their subject name

(1) ShareShare
ReportReport
Posted on by

Dear All,

I would need your urgent support on how to create the following flow:

 

Here is the situation:

  • I receive 7 file a day with different file names under same email subject
  • Currently I do it manually where I overwrite the files everyday

I need to build the following flow:

  • The flow should allow me to automatically store these files in Sharepoint, under the email subject name and not actual file name
  • this should be done daily at 7 A.M for all 7 files 
  • below is an example of how I receive the file and how I wanted to be stored

Meg_meg2_1-1651132236951.png

Meg_meg2_2-1651132296938.png

 

I really appreciate your support in advance!!

Please keep in mind that I am new to Power Automate and not an expert!

 

Thanks and regards.

  • Community Power Platform Member Profile Picture
    on at
    Re: Building flow to save file in sharepoint under their subject name

    Dear Georgios

     

    First please find below how I set the initialize varibale for SubjectName and if it is correct?

    Meg_meg2_1-1652773772207.png

     

    My question is that the file will be saved under Email subject name which is in my case: AMCA0602 - SCHQFP 011 A-L A-W 06 06, is that correct? 

     

    Thank you a lot for the support!

  • Verified answer
    GeorgiosG Profile Picture
    1,013 Super User 2024 Season 1 on at
    Re: Building flow to save file in sharepoint under their subject name

    It will run everytime you receive a mail, 👍 yes. 

  • Community Power Platform Member Profile Picture
    on at
    Re: Building flow to save file in sharepoint under their subject name

    Great that sounds exactly what I am looking for 

    One last question: will the flow run any time a new email email is received or do I have to schedule it.

    sorry I am still new to the Power Automate 

     

    thank you in advance 

  • GeorgiosG Profile Picture
    1,013 Super User 2024 Season 1 on at
    Re: Building flow to save file in sharepoint under their subject name

    Hi @Anonymous ,

     

    this flow will:

     

    • Create a document for each attachment in a mail
    • use the original file type
    • use the mail subject as file name 
    • if a mail has two attachments with the same file type, it will overwrite the file in SharePoint (or create a new version if versioning is enabled)
    • this flow works dynamically for all mails with attachments 

    Hope this helps you 😉

  • Community Power Platform Member Profile Picture
    on at
    Re: Building flow to save file in sharepoint under their subject name

    Dear GeorgiosG,

     

    I can see that you write the subjectName.xlsx in the field subjectName I need to apply this to seven files at once and not only one since every file has a different subject name. 

    Can above flow works or need to be ammended 

  • GeorgiosG Profile Picture
    1,013 Super User 2024 Season 1 on at
    Re: Building flow to save file in sharepoint under their subject name

    Yes Mail Subject will be new file name.

     

    47E2EBE5-88FD-49EE-95E2-88DA3FDE8714.jpegD059CC4B-C989-4532-91D5-CD023D461551.jpeg74ED2508-4C91-4B52-8D6E-5CB5FBEE6DE6.jpeg

  • Community Power Platform Member Profile Picture
    on at
    Re: Building flow to save file in sharepoint under their subject name

    Can you please share the final outcome of the flow you have shared (meaning file name received by email and how it is stored in sharepoint).

    thank you in advance and I appreciate your support!

  • Community Power Platform Member Profile Picture
    on at
    Re: Building flow to save file in sharepoint under their subject name

    Thank you for sharing: so basically this flow will ignore the actual name of file received bye email and this file name will be replaced with subject email?

  • GeorgiosG Profile Picture
    1,013 Super User 2024 Season 1 on at
    Re: Building flow to save file in sharepoint under their subject name

    Hi @Anonymous ,

     

    as far as I understood your requirements right your flow should look like this:

    Screenshot 2022-04-28 at 13.27.03.pngScreenshot 2022-04-28 at 13.28.02.png

     

    Expressions I used in the Flow:

    split(string(items('Apply_to_each')?['name']),'.')

    concat(triggerOutputs()?['body/subject'],'.',last(variables('subjectName')))
     
    What we basically need to do here is split the attachments name and use '.' as separator. We need the ending / file type of this. Next is using concat to add to your subject name a '.' and the extension. 
     
    It will create each time a new file in your SharePoint library, if the file exists already it will overwrite and create a new version if versioning is enabled in your library.
    GeorgiosG_0-1651145430156.png

    Enabling versioning: https://support.microsoft.com/en-us/office/enable-and-configure-versioning-for-a-list-or-library-1555d642-23ee-446a-990a-bcab618c7a37

     

    In the trigger of the Flow you can be more precise and filter only Mails with special SubjectName, from special people etc...

     

    Hope this helps you 😉

     
     

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

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 497 Super User 2025 Season 1

#2
David_MA Profile Picture

David_MA 436 Super User 2025 Season 1

#3
Riyaz_riz11 Profile Picture

Riyaz_riz11 244 Super User 2025 Season 1