How to overwrite files using the create file in Power Automate
Power Automate
Sep 27, 2023 1:09 PM

How to overwrite files using the create file in Power Automate

by HubSite 365 about Microsoft

Software Development Redmond, Washington

Citizen DeveloperSharePoint OnlinePower Automate

Solve SharePoint file overwrite issues with Power Automate create file action

In this comprehensive post, we delve into a frequently encountered issue that many individuals face while attempting to update pre-existing files within SharePoint utilizing the "create file" step in Power Automate. We will not only identify the root cause of this error but also provide you with a step-by-step guide on how to effectively resolve it, ensuring a seamless and efficient file management process within your SharePoint environment.

So, if you've ever grappled with this particular challenge, read on to discover the solutions and insights that will empower you to overcome it with confidence.

The Problem:

Bad Request error in Power Automate when trying to use the create file step to update an existing file in SharePoint.
Bad Request status: 400 Message: A file with the name [NAME OF FILE] already exists. It was last modified by [NAME OF USER] on [DATE]

Firstly, open the so-called ellipsis, denoted by three dots (…) and proceed to settings. Once there, scroll down until you find 'Content Transfer' and set 'allow chunking' to off. Afterwards, save the changes and re-run your flow. Viola! Your issue should be resolved and you should be able to successfully use the 'create file' step to update pre-existing files.

 

 

Chunking Background in SharePoint Online

Important Note: The 'chunking' feature is mainly used for dividing large content during downloads and uploads. Hence, it's crucial to think over your specific needs before deciding to turn off chunking in your particular flow. For more information, refer to detailed guides or resources available online.

SharePoint Online, you will be limited to the 250 MB file limit. If you attempt to go over this limit and catch the WebException, you will see this:
Response received was -1, Microsoft.SharePoint.Client.InvalidClientQueryExceptionThe request message is too big. The server does not allow messages larger than 262144000 bytes. In SharePoint On-Premises, you can change the Maximum Upload size (as shown above) to a maximum of 2 GB.
 
At this writing, there are some statements in at least one article on MSDN that says things like “ The maximum size of a binary file that you can add by using the REST API is 2 GB. ”
 
This statement is technically true, but the statement applies to the underlying framework, not the Maximum Upload Size set on the Web Application. This has confused more than a few developers and there may be a generally understanding that you can use the REST endpoints for /Add and /SaveBinaryStream to get around the apparent 250 MB file size limit. This is not true, the 250 MB Maximum Upload Size limit will likely remain in effect and you will need to use the chunked file approach to upload files larger than 250 MB.
 

General Insights About The Overwriting Files

Overwriting a file is quite a common task in file management. It primarily involves the replacement of an existing file with a newer version or a different one with the same name. Often during regular work hours, users might need to update or replace files. The method to do so can be cumbersome and error-prone if the tasks are not automated.

That’s where Microsoft's automation tool comes into play, offering a much simpler approach towards file management. It not only aids in overwriting tasks but also vastly improves the overall efficiency of the workload. You can automate a wide range of processes, not limited to just overwriting files but it can also include file transfers, deletion, and even creating automated responses.

Lastly, it's crucial to understand the utility of Microsoft's automation tool. In a rapidly digitizing economy, saving time, reducing errors, and improving efficiency are of utmost importance. By streamlining these tasks, businesses and individuals can focus on more critical aspects to deliver quality outputs.

Keywords

Power Automate overwrite files, Create file action, Automate file overwrite, Power Automate file actions, Overwrite files Power Automate, Using Power Automate, Power Automate create file, Automate file creation, File overwrite automation, Power Automate tutorials.