Development Flow Office 365 OneDrive SharePoint

Creating folders in OneDrive and SharePoint using Microsoft Flow

Two steps to Folder creation in OneDrive or SharePoint using Microsoft Flow - no Graph required

Microsoft Flow does not have an action to create folders in either OneDrive or SharePoint. To my mind this is an odd design choice by the Flow team. There are two ways to overcoming this shortcoming. The first is to use the Microsoft Graph or the SharePoint API in a HTTP action to create the folder. Whilst this offers maximum flexibility, as you could set other items like metadata and permissions, it strays into the grey area of Premium Flow licensing. It is also perhaps beyond the citizen developer. A far easier approach is using a Create File action and trick Flow into creating the folder. Perhaps trick is not the right word, especially as the Create File action hints at the possibility with the text ‘Add folders if needed‘ but it provides little guidance as to how. What happens is that a Create File action will create a new folder if it cannot find the folder you specify in the Folder Path field. That is the trick.

The Create File action includes help text that suggests you can create new folders
The clue…

In the example below, the re365 folder does not exist at the root level of my OneDrive. (Root level = top most level). The method works by creating a new file (in this case a text file) and then subsequently deleting the file to leave an empty folder (to be used in whichever way you need in your Flow).

Two OneDrive Flow actions (1) Create File (2) Delete File
Two steps to Folder creation in OneDrive

By adding the folder name re365 after the / (which represents the root level) in the Folder Path field causes OneDrive to create the folder first and then add a new text file called test.txt. Empty files can cause Flow to wobble and so I’ve included one word in the File Content field to ensure the file is not empty. The second action simply deletes the test file by calling it by its Id (which is an output of the previous step).

Shows new folder in OneDrive

The approach also works for SharePoint. In the example below I add the re365 folder to a Document Library called Shared Documents.

Two SharePoint Flow actions (1) Create File (2) Delete File
Two steps to Folder creation in SharePoint
Shows new folder in SharePoint

You can even dynamically name your folders by passing a string variable into the Folder Path item and nest your folder several levels down e.g. /re365/deep/deeperstill . The Action will create any missing hierarchy.


    1. Yes include an action to get the Subject of an email and then use that to name the folder. Just beware Subject lines can be long and you only have around 400 chars to play with when it comes to paths.


Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: