Create folders in a SharePoint document library using Power Automate

Recently, I’ve seen quite a few people asking about how to create folders in SharePoint Document Libraries using Power Automate.

Create folders in a SharePoint library

In my case I have a Document Library called Documents1 and I want to create a folder called New Folder

Using the Send an HTTP request to SharePoint action it is really a 5 minute task.

Using the following REST API call I can get hold of the option to create a new folder.


Just supply the body that specifies the name of your folder.

{ '__metadata': { 'type': 'SP.Folder' }, 'ServerRelativeUrl': '/Documents1/New Folder'}

You could of course also do the same without the verbose option and nometadata instead. The body would then look something like this:

{'ServerRelativeUrl': '/Documents1/New Folder'}

Run the flow

Then when you run the flow you will see that the HTTP call is successful

And my folder is created.

Document Libraries in various Site Collections

For site collections (that aren’t the root site collection) or subsites you can use the following:

Pieter Veenstra

Business Applications and Office Apps & Services Microsoft MVP working as a Microsoft Productivity Principal Consultant at HybrIT Services. You can contact me using

View Comments

  • thanks for this Pieter. With your help i've got it working wonderfully in our environment. We have a complex file structure of folders that i was already creating (by creating a file) in order to have one folder per sales order (with these folders grouped as there's lots). Now i've added in your flow code, tweaking it to use vairables so it's easier for me to manage, so i now have numerous sub folders for each parent folder ready for the team to store all job related docs in a tidy way. This is going to be a great help. thanks !

  • Thanks Pieter

    I'm a newbie... Could you introduce me to the rights allocation for the created folders ? Let's say a main folder in the Document Library called Documents1 , with many subfolders, all accessible to Group A, one of them being accessible only to sSecurity group B ?



  • “message”: “Value cannot be null.\r\nclientRequestId: b0a3299f-fb4e-44d3-826f-6bef4c739715\r\nserviceRequestId: 44d1cd9e-10cc-8000-6e87-a13417104134”,

    I am getting this error. I would appreciate your help.

  • Thank you for you prompt response. Here it is:

    Site Address
    Customer Bids –

    application/json; odata=verbose
    application/json; odata=verbose
    Enter key

    Enter value

    { ‘__metadata’: { ‘type’: ‘SP.Folder’ }, ‘SpWeb.ServerRelativeUrl’: ‘/BId%20Documents/New Folder’}

    • I think that your url to the folder isn't right. it isn't a server relative url. that would be /sites/....

      • Now getting the following error. Thank you again for your help;

        "error": {
        "code": 502,
        "source": "",
        "clientRequestId": "72737c0a-69f0-42d8-a945-60d7d3c56c1f",
        "message": "BadGateway",
        "innerError": {
        "message": "(null) \"sites/100010/sites/100010/BId Documents/New Folder\" not found.\r\nclientRequestId: 72737c0a-69f0-42d8-a945-60d7d3c56c1f\r\nserviceRequestId: 13d6cd9e-8072-8000-7de0-5daf09e8af45",
        "status": 502,
        "source": "'BId%20Documents')/Folders",
        "errors": [

        • it looks like /sites/100010 is repeated twice

          also in the get folder function the parameter doesn't appear to include /sites/100010

  • Hello, I am trying to create a folder within a Document library also but is getting the following error:

    “message”: “Value cannot be null.”,
    “status”: 400,
    “source”: “‘DocumentLibrary’)/Folders”,
    “errors”: [

    Thank you in advance!

    • inside the single quotes of the document library you need to include /sites/mainsite/subsite

        • at least in the byserverrelativeurl function as that would need to be everything after

      • Tried all three combinations off adding it to the GetFolderByServerRelativeUrl and ByServerRelativeUrl, Now getting a BadGateway error.

        • I added another screenshot for site collections that aren't the root site collection

  • Hello Pieter,
    I getting this error,

    "status": 400,
    "message": "Server relative urls must start with SPWeb.ServerRelativeUrl\r\nclientRequestId: ae4e610a-a527-4136-8b88-524b59f41b3c\r\nserviceRequestId: 1fa0d69e-80cd-8000-56fe-73dfc5582595",

    appriciate your help.

  • This is interesting however I find it ridiculous that this level of effort is required to do something so common. Is makes me wonder why Microsoft does not directly support creating folders from PowerApps & Flow.

    • Don't forget that they can't cover everything. There will always be some simple things that aren't there. But imagine if you had to do all that flow does in code... it would take 10 times longer.

  • I keep on getting this error

    “status”: 400,
    “message”: “The expression \”Web/GetFolderByServerRelativeUrl(‘sites/corporate-files/Lists/WIP Testing)/Clients’\” is not valid.\r\nclientRequestId: cc97207c-54cb-4496-8a2f-87b371d1096a\r\nserviceRequestId: d2b7d79e-9004-0000-99d4-8f792c168144″,
    “source”: “‘sites/corporate-files/Lists/WIP%20Testing)/Clients'”,
    “errors”: [

  • Pieter, I have tried lots of combinations and am starting to go a little mad.... Any advice would be greatly received....

  • {
    "message": "Access denied. You do not have permission to perform this action or access this resource.\r\nclientRequestId: ce926637-4e56-4da4-abbe-53603caf7680\r\nserviceRequestId: 276ede9e-30b3-8000-86d8-bb9bfaca2eeb",
    "status": 403,
    "source": "'sites/SurgeonCompliance/Shared%20Documents')/Folders",
    "errors": [

    • Hi,

      It looks like there is a / missing in front of sites/SurgeonCompliance in your ServerRelativeUrl

        • You would need to specify the parent folder name in GetFolderByServerRelativeUrl function and in the ServerRelativeUrl (in the Body) you will need to include the parent folder and the new folder name.

Recent Posts

Calculate the Sum for a SharePoint column in Power Automate

Last week Shane Young asked me about calculating the Sum for a SharePoint column in…

2 days ago

Object must implement IConvertible in Power Apps

In Power Apps when you do a Patch to create a new item or to…

6 days ago

Get started with adaptive cards in Power Automate

Getting started with adaptive cards can be difficult. In this post i have written some…

2 weeks ago

Create PDF documents from data in Power Automate

In this post I will look at how to create PDF documents from data. Use…

2 weeks ago

Unnest nested arrays in Power Automate

We all know this problem, you have a nested array in Power Automate but how…

3 weeks ago

Advanced settings not loading in Power Platform

Yesterday one of my clients showed me an issues where the Advanced settings didn't load.…

4 weeks ago