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 / Flow Overwrites Existi...
Power Automate
Answered

Flow Overwrites Existing Files in Sharepoint

(0) ShareShare
ReportReport
Posted on by 5

I wrote a flow to automatically take attachemnts from certain e-mails and save them to a folder in a Sharepoint document library. Every week it's supposed to upload the same 5 files. It's working fine, problem is Sharepoint is overwriting the existing files instead of just adding the new ones. I assume this is happening because the files have the same name every week. Unfortunately, I don't have a way to change that.

 

Any suggestions on how I can keep this flow running, but have Sharepoint add the new files alongside the existing documents rather than replacing them?

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

    @bryanw:

     

    Here are two suggestions:

    1) Simply append the current date to the file name when creating/saving the file to SharePoint

    2) Turn on versioning in the document library (it is enabled by default).  I believe that you'll find that when a new file is added that has the same name as an existing file:

    • the new file is added as a new version
    • the existing file is still there as a previous version
  • bryanw Profile Picture
    5 on at

    Thanks @ScottShearer, your first suggestion worked! Appending the date to the end added the date/time to the file extension, however appending it to the beginning did exactly what we needed. I may still try your versioning solution as well to keep the directory as clean as possible.

  • Vinit_Patil Profile Picture
    13 on at

    Hi Scott,

     

    I am using Save my email attachments to a SharePoint document library and under this i have used filter email condition. In this flow, the file gets overwritten if it has same name though I understand there are version created which is helpful. Is there anyway where we can check if the attachment has the same as available in the SharePoint Library and we can change it to current on the go?

     

    Also, are there any rules where I can create exactly above replica in Exchange Online instead of using Flow?

     

    Any suggestions are helpful. Please loop in exchange or SPO community if required.

     

  • ScottShearer Profile Picture
    25,270 Most Valuable Professional on at

    @Vinit_Patil:

     

    Here is a suggestion:

    • In your logic, add a SharePoint Get Files action for every attachment
    • Use an ODATA filter and filter on the file name of the attachment
    • If any items are returned by Get Files, you know the file already exists
      • If so, take action as suggested above to rename the attachment when saving to SharePoint

     

    Scott

     

  • Vinit_Patil Profile Picture
    13 on at

    Hi Scott,

     

    Based on your suggestion, I referred below articles for the requirement(Flow should be like --> if email received with specific "Subject" and has attachment that should be save to SPO lib and definitely it should not replace existing file if any.)

     

    While researching, I tried to follow several blogs but was stuck in filtering as per subject and in condition to check if file exists as demonstrated in this article:- https://powerusers.microsoft.com/t5/Building-Flows/Is-there-an-Exists-for-single-item-from-a-list-access/td-p/89440

     

    Also I am would like to concat the attachment name with current date if the file already exists in SPO Library as suggested below https://techcommunity.microsoft.com/t5/PowerApps-Flow/Concat-quot-Todays-Date-quot-for-File-Name-Save-Attachment-Help/td-p/140425

     

    If possible, can you please help me with steps with clear screenshots of the flow I am looking for so I can try to replicate. I am messing up in either of the steps while implementing.

  • tihomir4 Profile Picture
    10 on at

    @Vinit_Patil , did you find any solution? 

  • Community Power Platform Member Profile Picture
    on at

    Hi Team,

     

    Kindly help me in understanding the procedure to make the same named file get replaced in the SharepPoint folder without cross verification.

     

    Regards,

    Thamizh S

  • apal Profile Picture
    2 on at

    Please share your flow. As I want to overwrite the existing file each time as it has the same name.

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 503 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 321 Moderator

#3
abm abm Profile Picture

abm abm 237 Most Valuable Professional

Last 30 days Overall leaderboard