I have a problem with a flow, there are errors at the 'Create Folders' stage. I'm getting a bad request error message (see the Flow Errors header below).
The flow is meant to use an array that contains the name values for 8 sub-folders. The flow is triggered by a new folder being created, this is then meant to make the 8 sub-folders.
Research so far
I've read a lot of guides including this one on the MS Powerusers site which get me part way to what I want to do. I've used this to configure the Trigger Conditions:
IsFolder eq True (only kick-off the flow if a new folder is created).
Don't kick off the flow if the folder name equals e.g. 1. Pre Action Protocol correspondence
Flow Errors
There are two errors, but the 'Apply to All' error says "An action failed. No Dependent Actions Succeeded":
Create new folder - bad request error message:
Other info on the Flow, purpose of each step
As you see there are 8* sub-folders:
Folder names:
Pre Action Protocol correspondence
Pleadings, Order and Applications
Experts
Witness Statements
Documents
Internal correspondence
External correspondence
Counsel
*I've found that there is a hard limit of 10 trigger conditions. In order to prevent the flow being stuck in an endless loop, I was able to list the sub-folder names of 1- 8 in order to prevent the flow being triggered again by the creation of sub-folders.
(I have even more 'lower-level' folders too, but they'll be created manually, as I have insufficient trigger conditions to prevent the flow becoming struck in a folder creation loop).
The Initialise Variable step creates an array with the 8 sub-folder names:
The Parse JSON does this:
{
"type": "array",
"items": {
"type": "object",
"properties": {
"SubFolder": {
"type": "string"
}
},
"required": [
"SubFolder"
]
}
}
The Apply to All does this:
{
"type": "Foreach",
"foreach": "@body('Parse_JSON')",
"actions": {
"create_new_folder": {
"type": "OpenApiConnection",
"inputs": {
"parameters": {
"dataset": "https://Contoso.com/sites/T_Legal",
"table": "a33070d9-9a00-45cc-8886-97d2d0602c00",
"parameters/path": "Disrepair Claims/@{triggerBody()?['{Name}']}/@{body('Parse_JSON')}"
},
"host": {
"apiId": "/providers/Microsoft.PowerApps/apis/shared_sharepointonline",
"connection": "shared_sharepointonline",
"operationId": "CreateNewFolder"
}
},
"metadata": {
"operationMetadataId": "55385add-fc3f-4510-a591-ca632bf95992"
}
}
},
"runAfter": {
"Parse_JSON": [
"Succeeded"
]
},
"metadata": {
"operationMetadataId": "d4cebc2c-7940-4195-8c98-8e13fce335ab"
}
}
Folder creation step:
{
"type": "OpenApiConnection",
"inputs": {
"parameters": {
"dataset": "https://Contoso.com/sites/T_Legal",
"table": "a33070d9-9a00-45cc-8886-97d2d0602c00",
"parameters/path": "Disrepair Claims/@{triggerBody()?['{Name}']}/@{body('Parse_JSON')}"
},
"host": {
"apiId": "/providers/Microsoft.PowerApps/apis/shared_sharepointonline",
"connection": "shared_sharepointonline",
"operationId": "CreateNewFolder"
}
},
"metadata": {
"operationMetadataId": "55385add-fc3f-4510-a591-ca632bf95992"
}
}
Other Info
FYI - the value 'Disrepair Claims' is the name of an MS Teams channel.
This Stack Exchange question is semi-similar to mine, but I don't want to use an Excel file for the sub-folder names.
Update following Ganesh's answer
This is a Teams site which has pre-defined channels, so I have an extra layer compared to your answer - so yes, you were right to suspect I might have a slightly different set up.
Because I needed the subfolders to be created within the new channel, it means the trigger conditions need adjusting to prevent the folder creation command becoming stuck in an infinite loop. I still don't understand the fields and values Power Automate uses to adjust this myself, though I understand why its needed.
Update following Jan 4th comments
Here's how the create new folder action is configured:
The 'Name' field I see is listed in Dynamic Content under the (Sharepoint) When an item is created or modified section:
BTW - I'm working on a slight variant Flow which uses a manual trigger instead of the 'when a new folder is created' trigger. It's simpler this way to prevent SP/Power Automate going crazy creating 1,000s of folders!
I still find it difficult to point Power Automate to the correct location, I can't seem to force it to create the subfolders within the 'Project 1' location - it creates them at the same level as Project 1 instead of inside it. (I could post that as a separate question though, maybe it's an MS Teams issue rather than a Power Automate issue)












Project 1in my example below) at the top level AND you are creating the subfolder for each project and then want to create the subfolders defined in array inside the project folder. In that case, you will have to tweak the expression used in "Create new folder" action slightly (maybe I am confusing you with this comment).Disrepair/) in create new folder action.