Showing results for 
Search instead for 
Did you mean: 
Frequent Visitor

SharePoint Library Create File Overwrite as New Version

I have a flow that grabs an attachment from a SharePoint list item and creates a copy of it in a SharePoint library using the Create File action.


I have versioning turned on for the library, but the flow always fails if the file already exists in the library:


A file with the name Case Paperwork/test_attachment.txt already exists. It was last modified by i:0#.f|membership| on 23 Jul 2020 12:40:19 -0700.
clientRequestId: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
serviceRequestId: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx


All the documentation I've been able to find indicates that the file should be updated with a new version. Is there a setting I'm missing? I've attempted adding the same file to the library manually, and I am able to add it as a new version after encountering a warning that the file already exists. Is there a way to override that warning when adding files using a flow?

Community Support
Community Support

Hi jwerderits,

I just tried from my end and file could be normally updated without any warnings. In addition, I didn't see any error output from your snapshut. Do you mean it once worked normally? 
One simply mitigation operation is appending the current date to the file name when creating/saving the file to SharePoint 

Best Regards,
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thanks for the reply, Johnnyg.


The flow works normally when first creating the list item - that's the image I uploaded. The error occurs when a user makes an change to the list item. The goal is to have the flow run again on that list item and update the metadata columns for the file in the library. In most cases, the file won't be changing, so I want to avoid having duplicates of the file in the library since the list item may change several times. If the file does change, it should replace the old file in the library (this is why a new version would be ideal).

@jwerderits -- Hi! Did you ever find a solution for this? I am having the same issue.


I am recreating a number of SPD 2010 workflows in Power Automate. The original SPD 2010 wf was already appending a date stamp if called on to create a file that already existed in the library. This is sub-optimal, since I would expect the file to be overwritten with a new version number (versioning is turned-on for this library).


The Power Automate process creates the initial file, but simply throws an error when asked to create it again -- no new version, no datestamp, nothing!





@khumphries1 I never did get a solution and we ended up abandoning the planned functionality.

I have the same issue for the newly created flows. Old flows that were created few months ago works fine without any issue. But any new flow throws that error saying file exists with the name. I want to replace the old file with new one everytime it creates a file with the given name. File names have IDs from another list,

OK, kids -- here's how I solved it.

I can't rely on any sort of PA overwrite, so I always assume that the file already exists.

Since I know what the name of the file should be, I can attempt to delete the file -- which either succeeds or fails.

Regardless, I proceed to the next step of writing the file by configuring Run After on success or failure. If the delete failed, the file did not pre-exist and the subsequent write is successful. If the delete succeeded, the subsequent write is also successful.




Helpful resources

UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Users online (3,045)