cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
tidkeamol
New Member

Unable to overwrite already existing file in SharePoint library using Create file in MS Flow

Hi Team,

 

I have created a flow to copy files from on premise server(when file is created or modified in folder) using data gateway connector and upload it to specific SharePoint library using create file connector.

 

Flow is working fine for newly created or modified file but for the already existing files in SharePoint document library flow is failed to upload file and giving below error:

 

"status"400,
"message": "A file with the name TestFlowCopy/test61.txt already exists. It was last modified by i:0#.f|membership|testaccount@dom on 11 Dec 2020 03:22:51 -0800.\r\nclientRequestId: xyz \r\nserviceRequestId: xyz"
 
Ideally it should overwrite the existing file content and create version for the same.
 
Please help me to find solution for this issue. Reply is appreciated a much.
 
Thanks,
Amol Tidke 
 
1 ACCEPTED SOLUTION

Accepted Solutions
tidkeamol
New Member

Hi All,

 

I found a workaround for my issue that I am checking whether the file already exist in the document library or not. If the file is already there then I am using update file function in my Flow else I use create file.

 

Thanks & Regards,

Amol Tidke 

View solution in original post

10 REPLIES 10
abm
Super User
Super User

Hi @tidkeamol 

 

This behaviour is by design. The work around is check the file exists and delete the current file or rename the existing file.

 

Thanks



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blog
Power Automate Video Tutorials
tidkeamol
New Member

Hi All,

 

I found a workaround for my issue that I am checking whether the file already exist in the document library or not. If the file is already there then I am using update file function in my Flow else I use create file.

 

Thanks & Regards,

Amol Tidke 

Hi @tidkeamol 

 

If your problem has solved, please go ahead and mark the post as solved by clicking “Accept as Solution” so that this thread will be marked for other users to easily identify!

 

Thanks



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blog
Power Automate Video Tutorials
Pulsar93230
New Member

Simply disable 'Allow Chunking' in create file action settings.

It worked perfectly for me 🙂

Found the answer in another forum, don't remember where. Thks to his user if he read this !!

Thanks! works perfectly for me. 😀

wow, this worked for me also! thanks! I would never have found this on my own. Who even knows what "chunking" is?

Can you share how you do the check to see if a file exists? Does that mean looping through the SharePoint library to view every file and check it against the current file name in the loop?

Hi @Runner55552 

 

Here it is

 

image.png

 

Another way to use is use the Filter Query

 

See this video

 

How to check if a file exists in SharePoint Document Library using PowerAutomate - YouTube

 

Thanks



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blog
Power Automate Video Tutorials

I viewed the video, and that is one possibility, although his case was looking at a single file. In your image above, is there a step missing after Get File Metadata? Don't you need a condition statement to check if the filename returned is equal to the filename you are searching for?

Hi @Runner55552 

 

In my case I don't need because the first compose action declares my filename with the document library path. If successful it goes to Compose 2 step or if not found then Compose 3 will execute. You can extend the logic to set a boolean value here and in the final step you can check IF file found or not.



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blog
Power Automate Video Tutorials

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

Power Automate Designer Feedback_carousel.jpg

Help make Flow Design easier

Are you new to designing flows? What is your biggest struggle with Power Automate Designer? Help us make it more user friendly!

Top Solution Authors
Users online (3,268)