cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
servicesGB95
Advocate I
Advocate I

Overwrite file when creating a file in SharePoint

Hey guys,

in the recent flows I created it was normal that an existing file in SharePoint was simply overwritten when it had the same name as the new file. 
Right now I am creating a flow and Automate doesn't behave like this anymore, whenever I try to create a file with the same name I get an error.
Any solutions for that?

Thanks, Julian

34 REPLIES 34

In my case, I decided to skip it, wasn't critical since I was putting them into appropriately named folders.
But you could add an extra step to rename the file before copying it, or after. Adds unnecessary complexity but we're used to that.

Anonymous
Not applicable

@Luber I tried renaming the file before copying it but same error, file is locked for shared use, cannot rename. I've now added a delay before the Create File action, had to increment it to 9 minutes to work (hopefully) all the times, if I increase to 10, it times out. What could it be that locks that file 7-8 minutes before the flow will actually be creating (and overwriting) it?

Luber
Frequent Visitor

@Anonymous I've had that issue in other contexts, seems inconsistent. Then I guess try copying the file then renaming the new copy...?

Anonymous
Not applicable

hello @EnriqueC , can you kindly explain how this worked? or what does it do? 

Does it affect any long run functionalities / does it affect any data?

 

Kindly mention your answer.

Hi @Anonymous  - I do not know exactly what this does, however, it has work perfectly for the past year. One of my flows runs weekly and overwrites ~500 PDFs that are between 5MB - 50MB. No issues so far. 

 

Hope this helps. Regards.

Anonymous
Not applicable

Thanks a lot for your response @EnriqueC . 

this worked for me thank you so much!

This solution doesn't seem to work anymore. 

EnriqueC 's solution below to turn off Chunking works.

this is worked for me

Thanks a lot, it works for me.!!

Thank you so much! This worked for me.

Thanks, worked like a charm.

One question, is there a way to add a date stamp to each file (Export 28July2022, Export 29July2022) ?

This thread has the incorrect post marked as the solution, it is a shoddy workaround. The post this comment is replying to is the correct solution for this issue. Just turn off chunking, simple.

Not sure it's wise to use this hack.  

The proper way to do this is to use "Get Files (properties only)" filter by filename. 
Then add a condition.  
If the file exists use the "Update File" action
If the file does not exist, use the "Create File" action

It's more work, but that hack is not always guaranteed to work.

anirudhpm
Regular Visitor

Turning off 'Allow chuncking' worked for me as well. strange, but worked!

Helpful resources

Announcements
Power Automate News & Announcements

Power Automate News & Announcements

Keep up to date with current events and community announcements in the Power Automate community.

Power Automate Community Blog

Power Automate Community Blog

Check out the latest Community Blog from the community!

Users online (3,469)