If you’ve ever had a Power Automate flow fail because the target folder didn’t exist yet — or worse, accidentally created duplicate folders by running the same flow twice — you’re in exactly the right place.
In this tutorial, I’m going to walk you through three practical ways to create a folder in a SharePoint Document Library using Power Automate. I’ve personally tested all three approaches across real SharePoint environments, and I’ll tell you plainly which is the right tool for the job.
Here’s what we’ll cover:
- Method 1 — Simple folder creation using the built-in “Create new folder” action (best for beginners)
- Method 2 — Folder creation with a duplicate check using a Boolean variable (most reliable for production flows)
- Method 3 — Folder creation using Filter Array (more efficient for large libraries with 1,000+ items)
- Bonus: REST API method — for when you need full control over the folder path
I’ll also cover the most common errors people hit and how to fix them.
Which Method Should You Use?
Before jumping into the steps, here’s a quick decision guide:
| Method 1 (Basic) | Method 2 (Boolean Check) | Method 3 (Filter Array) | REST API | |
|---|---|---|---|---|
| Best for | Simple, one-time folder creation | Production flows where duplicates are a real risk | Large document libraries | Advanced scenarios, subfolders with dynamic paths |
| Duplicate-safe? | No | Yes | Yes | Depends on your logic |
| Steps to build | 3 | 6 | 6 | 5 |
| Skill level | Beginner | Intermediate | Intermediate | Advanced |
| Premium connector needed? | No | No | No | No |
Prerequisites
Before you start, make sure you have:
- A Power Automate account (free or licensed)
- Contributor or above permissions on the SharePoint site
- A SharePoint Document Library already created (not a List — this distinction matters, more on that below)

Create a SharePoint Folder in Power Automate
Now I will show you 3 different ways to create a SharePoint folder using Power Automate.
Method 1: Simple Folder Creation (The Quick Way) in Power Automate
This is the easiest method. Use it when you just need to create a folder and you’re not worried about whether it already exists — for example, in a scheduled flow that always creates fresh folders with unique names like a date or project ID.
Step 1 — Create the flow
- Go to make.powerautomate.com and click + Create
- Select Instant cloud flow
- Give your flow a name, e.g., Create SharePoint Folder
- Choose Manually trigger a flow as the trigger, then click Create
Step 2 — Add a text input for the folder name
- Expand the Manually trigger a flow card
- Click + Add an input → select Text
- Name it something like FolderName

This lets you type the folder name when you run the flow manually. You can also replace this later with a dynamic value from a form, Teams message, or a list item.
Step 3 — Add the “Create new folder” action
- Click + New step
- Search for Create new folder and select the SharePoint version
- Fill in:
- Site Address — your SharePoint site URL
- List or Library — choose your Document Library
- Folder Path — type
/followed by your dynamic folder name from the trigger. For example:/@{triggerBody()?['text']}

Tip on folder path: If you want a subfolder, use
/ParentFolder/SubfolderName. Always start the path with a/. Missing the forward slash is one of the most common causes of the “path is not valid” error.
Step 4 — Save and run
Click Save, then Test → Manually → Run flow. Type a folder name and hit run.
Once the flow completes successfully, head to your SharePoint document library and you’ll see the new folder there.

When this breaks: If the folder already exists, this method will throw an error. That’s exactly why Methods 2 and 3 exist.
Method 2: Power Automate Create Folder Only if It Doesn’t Exist (Boolean Variable Check)
This is my go-to method for production flows. It’s a bit longer to build, but it’s solid and easy to follow when you or a colleague reads the flow later.
The logic here is:
- Get all existing folders from the library
- Loop through them and check if our folder name matches anything
- Use a Boolean variable to track the result
- Only create the folder if the Boolean is still
false(meaning: no match found)
Step 1 — Set up the trigger
Same as Method 1 — Instant cloud flow with a Text input for the folder name.
Step 2 — Get all folders from the library
- Click + New step
- Search for Get files (properties only) and select the SharePoint action
- Fill in:
- Site Address — your SharePoint site
- Library Name — your document library
- Filter Query — enter exactly:
ContentType eq 'Folder'

The filter query is important. Without it, you’d loop through every file in the library, not just folders — which is slow and can hit Power Automate’s 5,000-item threshold.
Step 3 — Initialize a Boolean variable
- Click + New step
- Search for Initialize variable
- Fill in:
- Name:
isFolderExists - Type: Boolean
- Value:
false
- Name:

This is our “folder found” flag. It starts as false and we’ll flip it to true if we find a matching folder.
Step 4 — Loop through folders and check for a match
- Click + New step → search for Apply to each
- In the Select an output from previous steps field, select the value output from the Get files action
- Inside the loop:
- Add a Condition control
- Left side: select dynamic content Name (from Get files)
- Operator: is equal to
- Right side: select FolderName from the trigger
- In the If yes branch:
- Add a Set variable action
- Name: select
isFolderExists - Value:
true
- Leave the If no branch empty

Step 5 — Create the folder only if it doesn’t exist
After the Apply to each loop (not inside it):
- Click + New step → add a Condition control
- Left side: select the
isFolderExistsvariable - Operator: is equal to
- Right side:
false - In the If yes branch (folder does NOT exist):
- Add Create new folder
- Fill in the Site Address, Library, and Folder Path (same as Method 1)
- Leave the If no branch empty (or add a Compose action that says “Folder already exists — skipped” if you want a log entry)

Step 6 — Save and test
Run the flow with a folder name that already exists — the flow should complete without creating a new folder. Run it again with a new folder name — the folder should appear in SharePoint.
In my experience, this method works best when your library has fewer than 5,000 items total. If you have a very large library, consider Method 3 or use an OData filter query in Step 2 to pre-filter by folder name instead of looping through everything.
Method 3: Create Folder Using Filter Array (Cleaner for Larger Libraries) in Power Autoamte
This method swaps the Apply to each + Condition combo for a Filter Array action. Instead of looping through every folder one by one and flipping a Boolean, you filter the full list down to only folders matching your name in a single step. Then you just check if the result is empty.
This is more efficient and I find the flow canvas cleaner and easier to read.
Step 1 — Set up trigger and Get Files
Same as Method 2, Steps 1 and 2. Set up a manual trigger with a text input, and add Get files (properties only) with ContentType eq 'Folder' as the filter query.
Step 2 — Add a Filter Array action
- Click + New step → search for Filter array (it’s under the Data Operations connector)
- In the From field: select the value output from Get files
- In the condition row:
- Left side: select dynamic content Name (from Get files)
- Operator: is equal to
- Right side: the FolderName input from your trigger

This returns only the folders that exactly match the name you typed.
Step 3 — Check the length of the result
- Click + New step → add a Compose action
- In the Inputs field, click inside and then go to the Expression tab
- Enter:
length(body('Filter_array')) - Click OK

Why the Compose step? Power Automate doesn’t let you directly use the output count of Filter Array in a condition. Using Compose to evaluate the expression length first is the cleanest workaround.
Step 4 — Add a condition to create only if result is 0
- Click + New step → add a Condition
- Left side: the Outputs from your Compose step
- Operator: is less than or equal to
- Right side:
0 - If yes (no matching folder found): add Create new folder with your site, library, and folder path
- If no: optionally add a Compose with a note like “Folder already exists”

Step 5 — Save and test
Test with both an existing folder name and a new one to confirm the logic works correctly.
Bonus: Power Automate REST API Method (For Advanced Folder Paths)
Use this when you need to create a folder at a specific server-relative URL — especially useful when working with nested subfolders or when the built-in action doesn’t give you enough path control.
Step 1 — Set up the trigger
Same as all other methods — instant cloud flow with a text input for folder name.
Step 2 — Get existing folders (optional duplicate check)
Add Get files (properties only) with the same filter query as before if you want a duplicate check. Otherwise, skip to Step 3 and add error handling instead.
Step 3 — Get the library’s base path using Select + Compose
- Add a Select data operation:
- From: the
valueoutput from Get files - Map: key =
FolderPath, value = dynamic content Folder Path (from Get files)
- From: the
- Add a Compose action with this expression to grab the first folder path (we only need this to get the base library URL):
body('Select')?[0]
This gives you the server-relative base path like /sites/YourSite/Shared Documents.
Step 4 — Send an HTTP request to SharePoint
- Add the Send an HTTP request to SharePoint action
- Site Address: your SharePoint site
- Method: POST
- Uri:
/_api/web/folders - Headers:
accept:application/json;odata=verbosecontent-type:application/json;odata=verbose
- Body (copy and paste this):
{
"__metadata": { "type": "SP.Folder" },
"ServerRelativeUrl": "@{outputs('Compose')}/YourLibraryName/@{triggerBody()['text']}"
}
Replace YourLibraryName with the actual name of your document library (e.g., Shared Documents).
Step 5 — Save and test
Run the flow with a new folder name. If you get a 403 Forbidden, double-check that your connection account has at least Edit permissions on the SharePoint site. If you get a 400 Bad Request, the most common cause is the server-relative URL format — make sure there are no double slashes.
Common Errors and How to Fix Them
Here are the errors I see people run into most often — and what actually fixes them:
“The path for the new folder is not valid”
- Almost always a missing
/at the start of the Folder Path field. ChangeFolderNameto/FolderName. - Also check for special characters in the folder name. Avoid
#,%,&— SharePoint doesn’t handle these well in folder paths and Power Automate can double-encode them.
“A file or folder with this name already exists”
- You’re using Method 1 on a folder that already exists. Switch to Method 2 or 3 to add a duplicate check.
“BadGateway: Object reference not set to an instance of an object”
- This usually happens right after a new SharePoint site is provisioned and SharePoint hasn’t fully initialised the library yet. Add a Delay action (30–60 seconds) before the Create folder action.
Flow creates a folder on a List instead of a Document Library
- In the Get files (properties only) and Create new folder actions, make sure you’re selecting a Document Library, not a List. Folders behave differently in Lists and many actions don’t support them.
Folder path with spaces failing in REST API body
- Spaces in SharePoint paths need to be encoded as
%20when used in REST API calls. If your library is calledShared Documents, the path is/sites/YourSite/Shared%20Documents.
Apply to each loop running on 5,000+ items and hitting throttle limits
- Add
ContentType eq 'Folder'in the Filter Query of Get files (Properties only) to reduce the dataset. If the library is very large, consider using the REST API approach with a direct folder existence check via/_api/web/GetFolderByServerRelativeUrl('yourpath')instead.
Can Power Automate Create Nested Subfolders?
Yes, but you have to create each level separately. Power Automate won’t create intermediate folders automatically.
For example, to create /Projects/2026/March, you need three separate Create new folder actions (or a loop):
- Create
/Projects - Create
/Projects/2026 - Create
/Projects/2026/March
If you try to create the deepest level in one step and the parent folders don’t exist yet, the flow will fail with a path error. The REST API method gives you the most flexibility here since you can construct the full server-relative URL dynamically.
Real-World Use Cases
Here are a few scenarios where I’ve used these flows in actual SharePoint environments:
- New employee onboarding: When an HR team member fills a form, a flow automatically creates a
/HR/[EmployeeName]folder in a confidential documents library - Project kick-off automation: When a project record is created in a SharePoint list, a flow creates a folder structure like
/Projects/[ProjectCode]/Deliverables,/Projects/[ProjectCode]/Contracts - Monthly reporting: A scheduled flow creates a
/Reports/[Year]/[Month]folder at the start of each month, usingformatDateTimeexpressions to build the dynamic path - Client document portal: When a new client is added to a CRM-connected list, a flow creates the client’s dedicated folder, sets metadata, and sends a Teams notification
Frequently Asked Questions
Does Power Automate overwrite a folder if it already exists?
No — it throws an error instead. That’s why the duplicate-check methods (Method 2 and 3) exist. Always use one of those in production flows.
Can I create a folder in a SharePoint List (not a document library)?
You can, but it’s limited. Not all SharePoint Lists support folders natively, and the experience is inconsistent. For document management, always use Document Libraries.
Do I need a premium Power Automate license?
No. The SharePoint connector, including all actions used in this tutorial, is a standard connector and is included in Microsoft 365 licenses.
What’s the folder path format for subfolders?
Use /ParentFolder/ChildFolder. Always start with /. For the root of a library (creating a top-level folder), just use /FolderName.
Can I create a folder and set metadata (column values) at the same time?
Not directly with the Create new folder action. You need a separate Update file properties action after the folder is created. Target the folder by its ID returned from the Create action.
Summary of All Three Methods
| Duplicate-safe | No | Yes | Yes |
| Best library size | Any | Up to ~5,000 items | Any (more efficient) |
| Complexity | Low | Medium | Medium |
| Use in production | Only with unique names | Yes | Yes |
My recommendation: for any flow that might run more than once with the same folder name, always use Method 2 or 3. Method 1 is fine for scheduled flows that generate unique names (like date-stamped folders).
Also, you may like:
- Power Automate Send Reminder Emails
- Power Automate: Format Dates to ISO 8601
- Create an HTML Table from an Array in Power Automate
- Add Excel Table into HTML Email Body using Power Automate Desktop

After working for more than 18 years in Microsoft technologies like SharePoint, Microsoft 365, and Power Platform (Power Apps, Power Automate, and Power BI), I thought will share my SharePoint expertise knowledge with the world. Our audiences are from the United States, Canada, the United Kingdom, Australia, New Zealand, etc. For my expertise knowledge and SharePoint tutorials, Microsoft has been awarded a Microsoft SharePoint MVP (12 times). I have also worked in companies like HP, TCS, KPIT, etc.