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

Community site session details

Session Id : d5yJNkceVHJ1CsIxiRLo3E
Power Automate - Using Flows
Unanswered

Save Office 365 email attachments to OneDrive for Business

Like (0) ShareShare
ReportReport
Posted on 19 May 2021 12:25:50 by 4

hello

 

i use this flow " Save Office 365 email attachments to OneDrive for Business" to automatically download the attachments of incoming emails, but the files I download have the same name. i have saved four but have not kept saving the others

 

wait for answer

 

thanks for advance 

  • Pstork1 Profile Picture
    67,176 Most Valuable Professional on 25 May 2021 at 19:44:31
    Re: Save Office 365 email attachments to OneDrive for Business

    Add seconds creates a date value, which you can't use as a filename.  I was suggesting something more like this. Which will append a unique number based on today's date to the end of the filename .

    concat(outputs('Get_file_metadata')?['body/NameNoExt'],formatDateTime(utcNow(),'yyyymmdd'),'.doc')

     

     

  • dyeregui Profile Picture
    4 on 25 May 2021 at 18:31:08
    Re: Save Office 365 email attachments to OneDrive for Business

    hello sir,

     

    try putting this expression of adding seconds in the part of creating file but it doesn't work, as it should be?

    dyeregui_0-1621967413804.png

    thanks for advance!!

     

  • Pstork1 Profile Picture
    67,176 Most Valuable Professional on 21 May 2021 at 12:28:41
    Re: Save Office 365 email attachments to OneDrive for Business

    In the action where you create the file in OneDrive make sure that the filename field has a unique file name instead of just re-using the same file name.  One way to do that would be to strip off the extension and then concatenate text to the end based on the date and time.  Make sure you also replace the file extension after adding the extra text.

  • dyeregui Profile Picture
    4 on 21 May 2021 at 10:42:32
    Re: Save Office 365 email attachments to OneDrive for Business

    hello Pstork1

     

    How do I make the file save a different name and prevent the file from being replaced?

     

    thanks for advance

  • Pstork1 Profile Picture
    67,176 Most Valuable Professional on 21 May 2021 at 03:00:22
    Re: Save Office 365 email attachments to OneDrive for Business

    If you save files with the same name overtop each other then yes, they will overwrite the existing file.  The same thing happens if you just upload the file to OneDrive.  You can't save more than one file using the same name.  Its just not possible in OneDrive.  You need to add something to the filename when you create the file in the Flow to differentiate it from the one that is already there.

  • schavas28 Profile Picture
    2 on 21 May 2021 at 01:54:29
    Re: Save Office 365 email attachments to OneDrive for Business

    Hello Community

     

    I'm running the same  issue as above as I've been having some issues with one of my flows trying to save email attachments (in my case are excel files) that are named the same way.

    See below the names of the files I'm currently having issues with:

    CBK_ADHOC_RESUBMISSION_STATUS_RPT_GR.CSV

    CBK_ADHOC_RESUBMISSION_STATUS_RPT_PF.CSV

     

    So for instance, let's say today I received some emails with their attachments (excel files under those names) they will be saved in the folder I created in One Drive, but if I received tomorrow or another day some attachments with the same name, they will replace the ones that are in the folder, which is not the case because each excel file contains different information. My desire to fix this issue is to save all the attachments (excel files under the same name but different information)in the same One Drive folder no matter they share the same name.

     

    Hope you can help me ASAP.

     

    Thanks

  • Pstork1 Profile Picture
    67,176 Most Valuable Professional on 19 May 2021 at 12:34:16
    Re: Save Office 365 email attachments to OneDrive for Business

    I looked at the template.  The files should retain whatever name they had as attachments.  Are you saying all downloaded files have the same name?  or that the names are the same as the name of the attachment?  If its the later that's the way its designed to work.  Can you provide more detail on exactly what your problem is?

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

Announcing our 2025 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for…

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!

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 497 Super User 2025 Season 2

#2
David_MA Profile Picture

David_MA 436 Super User 2025 Season 2

#3
Riyaz_riz11 Profile Picture

Riyaz_riz11 244 Super User 2025 Season 2

Featured topics

Restore a deleted flow
Loading complete