cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Regular Visitor

SharePoint Flow Create File Errors When Versioning Is On

I'm creating a flow to perform a double layer approval process for all documents created or modified in the WorkInProgress folder of my document library.  There is a MS Word template that is used to create new documents in the folder.  The document library has versioning enabled.

 

In the flow, after the approval processes pass; the flow then moves the document to the correct sub-folder based on the Department (custom file property) of the document and updates the file properties to set a review date for 1 year in the future.

 

That all runs perfectly.

 

While testing the flow, I noticed that it was possible to name the file something other than the title of the document (which is something that I didn't want).  I haven't been able to find a way to force the name of the document to be the same as the title in the situation where the file is saved before the title is created or manually typed in wrong.  So, I've tried to put a step in the flow that checks the name of the document verses the title of the document and then rename the document file if it is different.  I set the flow to create a new file with the correct name and then delete the incorrectly named file.

 

When I try to run the flow with a file that is named differently than the title, it hangs on the create file action.  The file IS created and named correctly, the flow just timed out at that action.

 

After lots of testing and messing around with it, I get the following different errors:

 

1)  If I don't have any actions after the Create File action, the flow runs successfully.  The file is created and named correctly; but it's Approval Status is set to Draft and the file is checked out by the flow account.  So a separate flow would need to be created to check in and set the file to approved, which would be a pain because I would have to set a tag custom file property to check against to see if it was a flow created file or if it was just moved into the folder by a flow.

 

2)  If I add a Check File In action after the Create File action, the flow continues passed the Create File action, but fails on the Check File In action and I get the error, "Bad Request: You cannot checkin and overwrite a published file."  When I look in SharePoint, the file is created and named correctly, but the Approval Status of the file is set to Draft and the file is checked out by the flow account.  So again, a separate flow would need to be created and same issues.

 

3)  If I add a Set Content Approval Status action after the Create File action, the flow fails and I get this error on the Create File action, "InvalidContentRangeHeader.  The response to partial content upload request was not valid.  The returned range header value 'bytes=0-76088' is not in expected range of '0-76088' with unit set to 'bytes'."  Ya, you guessed it, same results in SharePoint where the file was created and everything but not ideal.

 

So, I am confused as to why I am not able to have any actions after the Create File action in the flow without it causing some sort of error and why the error is not consistent.

Helpful resources

Announcements
firstImage

Super User Program Update

Three Super User rank tiers have been launched!

firstImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

Top Solution Authors
Top Kudoed Authors
Users online (8,972)