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:firstname.lastname@example.org 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?
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
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!
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.