If you want to create a folder in OneDrive using Power Automate, you’re out of luck. There’s no action to do it, and, frankly, it’s pretty strange that Microsoft didn’t include it in the actions. It’s not like Microsoft doesn’t allow us to create folders in SharePoint using the “Create new folder” action. But, it’s still an idea, and it’s on Microsoft’s radar, so if you want this to become an action, please go to the idea section of the community and vote.

Microsoft doesn’t tell us directly, but OneDrive for Business is a glorified SharePoint Document Library (more or less), but the point stands. If we can do it in SharePoint, why not on OneDrive for business?

I don’t have the answer to this, but I have a simple solution.

We can create files

Although we cannot create folders, we can create files using the “Create file” action. One of the indirect benefits of using it is defining the path.

But what happens if we define a folder that doesn’t exist. For example:

Create a folder example step one where we don't have anything created.

We have an empty folder, and we want to create a folder with a draft text file in the “DRAFT” folder. Here’s the Flow to do it:

The "create file" action in Power Automate pointing to the folder that we want to create.

Let’s run the Flow and see what happens.

After the Flow runs the file and folder are created in the desired location.

Finally, we can get our file and a “free” folder.

How about multiple folders. Let’s imagine creating the “DRAFT” folder and the “IMAGES” inside it. Taking a step further to prove the point, let’s add another level. Inside the “IMAGES,” we’ll create a “TO PROCESS” folder. So we’re making the “IMAGES” and “TO PROCESS.”

Here’s the Flow:

The "create file" action in Power Automate contains a nested set of folders to show that we can create multiple at the same time.

And here’s the final result:

After the Power Automate runs we see that multiple folders were created at the same time.

So we can create not only a folder but an entire hierarchy. With this, we can work, so let’s look at the workaround.

The workaround

So with what we got in the previous chapter, we have a potential strategy. We can try to do it as follows:

  1. Create a file in the folder or set of nested folders
  2. Delete the file that we created.

It’s not at all critical of the file, extension, structure. We must have a file to create the folder structure.

It’s simple, and as a result, we’ll have the folder structure that we want. So let’s look at how to do it:

Explanation on how to properly link the "create file" action with the "delete file" action.

First, let’s empty the folder to get the total result:

Create a folder example step one where we don't have anything created.

And after we run the Flow, we get:

Example showing the multiple folder creation and removing the file

Awesome 🎉.

Final thoughts

Although we don’t have an action to create a folder in OneDrive, we can have a nice workaround and create a folder hierarchy in the process.

Have a suggestion of your own or disagree with something I said? Leave a comment or interact on Twitter and be sure to check out other Power Automate-related articles here.

Photo by Savannah Wakefield on Unsplash

Manuel Gomes

I'm a Project Manager with experience in large projects and companies. I've worked in the past for companies like Bayer, Sybase (now SAP) and I'm currently working for Pestana Hotel Group.

View all posts by Manuel Gomes →

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: