Showing results for 
Search instead for 
Did you mean: 
Regular Visitor

Populate a Word template - 400 error opening the selected file

My flow but simplified:


Okay first - what is happening here:

'Populate 1' picks a 'Template.docx'

'Create file' creates a file 'MyFile.docx' with 'Populate 1' in SharePoint


If 'Create file' was succesful:

'HTTP Post 1' is a Azure Function. It loads 'MyFile.docx' edits it and overwrites 'MyFile.docx' in SharePoint.


If 'Create file' was unsuccesful (in this case 'MyFile.docx does already exist):

'HTTP Post 2' does exactly the same thing as 'HTTP Post 1'.

'Populate 2' picks 'MyFile.docx'

'Update file' updates 'MyFile.docx' with 'Populate 2'.


If I run this flow twice (first run creates 'MyFile.docx' - second run updates it) 10 times 'Populate 2' will fail and succeed an unpredictable number of time.


My error:

"body": {
        "message""There was an error opening the selected file. Please check the file and try again.\r\nclientRequestId: ****7***-f**6-4**e-****-***653******",
        "error": {
            "message""There was an error opening the selected file. Please check the file and try again."
What I noticed when this error occurs:
The Content-Length is smaller than it should be.
I can open (or download and open) the file without any problems manually and it is complete.
When opening the file online for the first time, the file looks like this for a split second:
after the split-second (or if 'Populate 2' was successful):



Now another weird thing: If the flow terminates after 'Create file' and I run it again for the Update-Case 'Populate 2' seems to work without problems so far.

Putting a Delay between 'Create file' and 'HTTP Post 1' won`t change the fact that 'Populate 2' might end in an error.


Helpful resources

Process Advisor

Introducing Process Advisor

Check out the new Process Advisor community forum board!

MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Top Solution Authors
Top Kudoed Authors
Users online (39,236)