Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Automate - Using Flows
Unanswered

Save Office 365 email attachments to OneDrive for Business

(0) ShareShare
ReportReport
Posted on 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
    66,026 Most Valuable Professional on at
    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 at
    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
    66,026 Most Valuable Professional on at
    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 at
    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
    66,026 Most Valuable Professional on at
    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 at
    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
    66,026 Most Valuable Professional on at
    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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,702 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 66,026 Most Valuable Professional

Leaderboard

Featured topics

Restore a deleted flow