Automation is key when it comes to automatic documentation, and creating folders and templates automatically is the way to get things prepared and done for you. Create a new folder is quite a simple task, but think about more complex nested folders and other operations that can be done automatically. SharePoint’s create new folder action helps with this.
Where to find it?
Although you can navigate in the structure, it’s always better to search for what you want. In our case, we want SharePoint:
And then pick the “create new folder” action.
To create a new file you need 3 things:
- The site address – Where will you create it.
- A list or library inside that site – Since you can have multiple both, you need to choose the one you want.
- The path to the folder
The last one holds a few tricks, so let’s explore them.
It doesn’t need to be only one folder.
If you want to create a whole folder structure that doesn’t exist, you can create the full path, and it will be created for you so if you’ll have multiple new folders created. For example:
It will complete paths that are missing
If you have a path like above and want to create a fourth or fifth level, you can define the path, and the “create new folder” action will only create the folders that don’t exist. If there are files inside those folders, Power Automate won’t touch these.
Build your own path
Completing the above example, let’s move the path outside the “Create new folder” action.
Let’s run, and we’ll get the “Fourth Level” as expected.
This is not a limitation per se, but you should be aware of it. If you use the “Create new folder” action and try to move or create files in the next action, your Flow may fail. This is because, although SharePoint is quite fast creating folders, it’s not instantaneous. If you get an error, a workaround adds a small delay using the “delay” action. It’s not an elegant solution, but in this case, SharePoint may need a bit extra time to create the folder structure.
Here are some things to keep in mind.
Name it correctly
The name is super important in this case since we’re getting the file by either calculating the path or having a defined static one. Always build the name so that other people can understand what you are using without the need to open the action and checking the details.
Always add a comment.
Adding a comment will also help to avoid mistakes. Indicate where the path comes from, for example, if it’s calculated and how. It’s important to enable faster debugging when something goes wrong.
Always deal with errors.
Files may change places and names, so what’s true now is not a few weeks from now. Have your Flow fail graciously when the file doesn’t exist and notify someone that the file is missing. It’s horrible to have failing Flows in Power Automate since they may go unlooked for a while or generate even worse errors.
Back to the Power Automate Action Reference.