Create a new sub site using Power Automate! Microsoft Office 365, Microsoft Flow getsite

Today we have seen an exciting new action added to Microsoft Flow! The action is called Send an HTTP request to SharePoint.

In this post I’m going to have a look at how to get site details out of SharePoint and after that I will look at the more exciting bit of how to create a new sub site. This will open many doors to site request processes in Office 365. Imagine creating a site request list, go through an approval process and create your team site all within no time at all.

Get Site details

I’m going through this step just to explain the basics.

Once you have found the Send an HTTP request to SharePoint action, all you have to do is supply the details to the REST API endpoints. Details can be found on the Microsoft Docs site.

Ok, so the Uri to be used is simply /_api/web

List the details of a site using the HTTP request to SharePoint

don’t forget to set the header to Accept=application/json;odata=verbose

Ok, this was easy. When you now look at the run output from your flow you will find ll the details of the site in json format!

Now the more exciting bit.

Create a new sub site

This time we need to use the POST method to call our SharePoint REST API.

the uri now is /_api/web/webinfos/add

Then once again set the headers. In this case you don’t need to use the verbose option. You could use nometadata instead however I have got used to the extra bits needed in the body when using the verbose option.

Accept=application/json;odata=verbose

Content-Type=application/json;odata=verbose

and the Body needs to be set to something like this:

{ 'parameters':
  { '__metadata':
    { 'type': 'SP.WebInfoCreationInformation' },
    'Url':'testsiteflow2',
    'Title':'My Title2',
    'Description':'My Description',
    'Language':'1033',
    'WebTemplate':'STS#0',
    'UseUniquePermissions':false
  }
}

The Url in the above json will be the url used within the site give in the Site Address to create a new sub site. So you would most likely use some dynamic content to set this Url.

The template I’ve set to STS#0.  This will give you a team site but of course you could select any of the other templates. But imagine creating modern team sites. Yes you can do this by just updating the WebTemplate in the above to STS (without the #0)

Do you still remember creating dictionaries in SharePoint Designer? Just to get this one call done you had to create 4 of those dictionaries. Now we’ve just just plain simple text feeding the site creation process.

Create a new sub site using Microsoft Flow

Now run your flow and your site will be created!

Success Handling

When you created a new sub site you could set a variable of the type Object to the Body that is returned by the HTTP request action. This will return something like this:

{
  "d": {
    "__metadata": {
      "id""https://pieterveenstramvp.sharepoint.com/_api/web/webinfos/add",
      "uri""https://pieterveenstramvp.sharepoint.com/_api/web/webinfos/add",
      "type""SP.WebInformation"
    },
    "Configuration"0,
    "Created""2018-05-02T16:37:28",
    "Description""My Description",
    "Id""26cad790-c071-4d82-acba-e443620b87b3",
    "Language"1033,
    "LastItemModifiedDate""2018-05-02T16:37:51Z",
    "LastItemUserModifiedDate""2018-05-02T16:37:51Z",
    "ServerRelativeUrl""/testsiteflow3",
    "Title""My Title2",
    "WebTemplate""STS",
    "WebTemplateId"0
  }
}
successHandling

Error handling

When things go wrong however you need to handle things to. This starts by setting the run after settings.

Run after settings

Then you will get a BadGateway error returning the following json

{
  "error": {
    "code"502,
    "source""europe-001.azure-apim.net",
    "clientRequestId""861c4a53-f91b-4945-ae71-3335403eb634",
    "message""BadGateway",
    "innerError": {
      "status"502,
      "message""The Web site address \"/testsiteflow3\" is already in use.\r\nclientRequestId: 861c4a53-f91b-4945-ae71-3335403eb634\r\nserviceRequestId: 7b3e639e-70e7-5000-de78-8990577b77ff",
      "source""https://pieterveenstramvp.sharepoint.com/_api/web/webinfos/add",
      "errors": [
        "-2147024713",
        "Microsoft.SharePoint.SPException"
      ]
    }
  }
}

Where can I use this?

Just to give you a few ideas. There are of course a lot more.

  • You could create project sites as projects are registered in your PMO solution. Or
  • you could create a Client site as your new client has been added to CRM.
  • Or maybe create a site after a survey in Microsoft Forms has been completed? The options are endless.
Avatar for Pieter Veenstra

By Pieter Veenstra

Business Applications Microsoft MVP working as the Head of Power Platform at Vantage 365. You can contact me using contact@sharepains.com

71 thoughts on “Create a new sub site using Power Automate!”
  1. Hi Pieter using REST calls within Flow is a game changer ! – No more SharePoint Designer Workflows as you can do almost everything with REST calls ! Hurrah !

  2. Hi Pieter,
    I’m not finding Send an HTTP request to SharePoint action in available actions in Flow, do you know if this is only available for early adopters?

    Thanks,

    Art

    1. HI Dominique,

      I haven’t tried creating site collections yet. It would be different to create a site collection. Traditional sites you can create with the admin service. I guess creating new team sites you could do with the teams connector.

  3. Any luck getting Flows to run on subsites? They don’t show up for me, am assuming subsites aren’t supported.

    1. Hi chad, you mean having a trigger start on item creating within lists in a subsite? It wokrs for me so it should be ok. You might have to add the url of the subsite by adding the url manually rather than selecting it form the drop down.

  4. Hello Pieter
    Would you know the what I have to put in so that the top link navigation is inheritance is activated

    Thanks

    Miles

  5. Thanks for this, really useful. Is it possible to set permissions on the Subsite and not inherit from the parent?

  6. Hi All,
    I’ve tried the code above in MS Flow several times now, and the flow is FAILING with the following output returned in the HTTP Response:

    “status”: 400,
    “message”: “The property ‘__metadata’ does not exist on type ‘SP.WebInfoCreationInformation’. Make sure to only use property names that are defined by the type.\r\nclientRequestId: b4e4d5fe-0d1c-425e-bf6d-fb1a525d6c4b\r\nserviceRequestId: 04c9819e-b003-6000-20af-c856f48a57c6”,
    “source”: “https://ieaonline.sharepoint.com/sites/testsc/_api/web/webinfos/add”,
    “errors”: [
    “-1”,
    “Microsoft.Data.OData.ODataException”
    ]

    NO ONE else seems to be having this less-than-ideal experience I’m having 🙁

    Thoughts?

    -Mark in North Aurora IL

  7. SOLVED recently-reported problem (getting HTTP 404 error):
    CAUSE: I neglected to add the “Content-Type” HTTP Request Header variable in my HTTP POST request, that’s all 🙂

    WORKING now, and I’m with the others who commented:
    – MSFlow is MORE than a replacement for SPD Workflows 🙂
    – MSFlow is true SOA-styled SCALABLE, ROBUST workflow for automation 🙂
    – MSFlow can be MOBILIZED readily (talk about CODE RE-USE !) 🙂
    and
    – THIS SendHTTPRequest Action was the codeless tool we’ve been waiting for in MSFlow !

    TO PONDER…
    The whole philosophy behind MSFlow is that it’s “code-less”; but I find it ironic that in order to fully UNDERSTAND MSFlow… many users often times find themselves UNDERSTANDING “CODING” better than they EVER did (or had to) when doing “pure coding” 😉

    All MSFlow really does is effectively “VISUALIZE” or “DIAGRAM-IZE” your coding efforts, as opposed to force you to MENTALLY VISUALIZE your coding.

    MSFlow truly MERGES the “textual” and the “visual” aspects of understand program execution, PARTICULARLY in a distributed SOA-based environment where there are truly generalized “clients” consuming “services”.

    IF anyone is old enough to remember the 20+ YEARS back to MACROMEDIA, and its DIRECTOR interactive application design environment,, you’ll see how far (or how LITTLE) we’ve actually progressed in more than 2 decades; I guess we simply got distracted by this construct now called “the INTERNET” 😉 …

    – Mark

  8. Hi ,
    Flow works cool !!!
    how to add global navigation Display the same navigation items as the parent site
    using JSON code please advice ..

    1. Hi Karthick, I don’t think that the REST API allows you to do this. You could use an Azure function to do this for you. This azure function can then be called from Flow.

      1. Hi Pieter,

        I found a post from you, above on the 28th of august last year.

  9. Could you select a Custom site template to be used? If so, how do I find out what the STS numbers are for the custom templates? Or, how are they identified? Thanks!

  10. Update – i found where to update the webtemplate part a few posts up :). With this in mind, say we have 15 different custom templates. Do you think using Flow like this is a practical solution? Trying to find an alternative to Nintex. Thanks!

  11. Hi Peter, thanks for this article, one issue i am hitting is that you have two choices when you create a subsite and specify ‘UseUniquePermissions’ which can be true or false. If its false it keeps the parent groups in the subsite (ok all good) but i don’t want this so set it to true, the site is then created with no site groups. Whilst i can add my own sharepoint groups with similar rights , Owner-full control, member-edit/contribute, visitor-read this isn’t great as you can’t set them to be the default groups via Flow/ send as http request, so this impacts things like when you share, the sharing dialogue may default to the owners group which is not desired (i.e. if the user doesn’t realise and clicks / expands the more options when sharing a file).. So I kind of want to provision the subsite with an AssociatedMemberGroup, AssociatedOwnerGroup specified via the REST API, using Flow and “send as HTTP actions” I see several posts of people saying the GET method is supported but not the POST method. Any ideas, have you ever hit this?. Trying to do all it all without using Azure / Pnp

  12. Hi Pieter, great post.

    I am not too familiar with SharePoint but was able to follow the post and create a list where a custom template sub-site is created. What I am looking for, perhaps goes into the body section(?) as it seems similar to the other items being notated there, but would you know (or be able to provide a way to figure this out for future instances) what language to use within the ” for the following from manually creating the sub-site to use in the body(?):

    Navigation:
    Display this site on the Quick Launch of the parent site? (y/n)
    Display this site on the top link of the parent site? (y/n)

    Navigation Inheritance:
    Use the top link bar from the parent site? (y/n)

    Is there syntax that would provide an easy true/false for the above?

  13. Hi Pieter – I’m having trouble finding what details to use for the REST API endpoints. I’m getting an error if I use the uri: /_api/web/webinfos/add. If I type this into my browser, I get an error: “The HTTP method ‘GET’ cannot be used to access the resource ‘Add’. The operation type of the resource is specified as ‘Default’. Please use correct HTTP method to invoke the resource.”

    Thank you for any help!

    The output of the GET function is:

    D7203-UUP2P3S-BYNWP0{
    “d”: {
    “__metadata”: {
    “id”: “https://abccre.sharepoint.com/projects/_api/Web”,
    “uri”: “https://abccre.sharepoint.com/projects/_api/Web”,
    “type”: “SP.Web”
    },
    “FirstUniqueAncestorSecurableObject”: {
    “__deferred”: {
    “uri”: “https://abccre.sharepoint.com/projects/_api/Web/FirstUniqueAncestorSecurableObject”
    }
    },
    “RoleAssignments”: {
    “__deferred”: {
    “uri”: “https://abccre.sharepoint.com/projects/_api/Web/RoleAssignments”
    }
    },
    “Activities”: {
    “__deferred”: {
    “uri”: “https://abccre.sharepoint.com/projects/_api/Web/Activities”
    }
    },
    “ActivityLogger”: {
    “__deferred”: {
    “uri”: “https://abccre.sharepoint.com/projects/_api/Web/ActivityLogger”
    }
    },
    “Alerts”: {
    “__deferred”: {
    “uri”: “https://abccre.sharepoint.com/projects/_api/Web/Alerts”
    }
    },
    “AllProperties”: {
    “__deferred”: {
    “uri”: “https://abccre.sharepoint.com/projects/_api/Web/AllProperties”
    }
    },
    “AppTiles”: {
    “__deferred”: {
    “uri”: “https://abccre.sharepoint.com/projects/_api/Web/AppTiles”
    }
    },
    “AssociatedMemberGroup”: {
    “__deferred”: {
    “uri”: “https://abccre.sharepoint.com/projects/_api/Web/AssociatedMemberGroup”
    }
    },
    “AssociatedOwnerGroup”: {
    “__deferred”: {
    “uri”: “https://abccre.sharepoint.com/projects/_api/Web/AssociatedOwnerGroup”
    }
    },
    “AssociatedVisitorGroup”: {
    “__deferred”: {
    “uri”: “https://abccre.sharepoint.com/projects/_api/Web/AssociatedVisitorGroup”
    }
    },
    “Author”: {
    “__deferred”: {
    “uri”: “https://abccre.sharepoint.com/projects/_api/Web/Author”
    }
    },
    “AvailableContentTypes”: {
    “__deferred”: {
    “uri”: “https://abccre.sharepoint.com/projects/_api/Web/AvailableContentTypes”
    }
    },
    “AvailableFields”: {
    “__deferred”: {
    “uri”: “https://abccre.sharepoint.com/projects/_api/Web/AvailableFields”
    }
    },
    “ClientWebParts”: {
    “__deferred”: {
    “uri”: “https://abccre.sharepoint.com/projects/_api/Web/ClientWebParts”
    }
    },
    “ContentTypes”: {
    “__deferred”: {
    “uri”: “https://abccre.sharepoint.com/projects/_api/Web/ContentTypes”
    }
    },
    “CurrentUser”: {
    “__deferred”: {
    “uri”: “https://abccre.sharepoint.com/projects/_api/Web/CurrentUser”
    }
    },
    “DataLeakagePreventionStatusInfo”: {
    “__deferred”: {
    “uri”: “https://abccre.sharepoint.com/projects/_api/Web/DataLeakagePreventionStatusInfo”
    }
    },
    “DescriptionResource”: {
    “__deferred”: {
    “uri”: “https://abccre.sharepoint.com/projects/_api/Web/DescriptionResource”
    }
    },
    “EventReceivers”: {
    “__deferred”: {
    “uri”: “https://abccre.sharepoint.com/projects/_api/Web/EventReceivers”
    }
    },
    “Features”: {
    “__deferred”: {
    “uri”: “https://abccre.sharepoint.com/projects/_api/Web/Features”
    }
    },
    “Fields”: {
    “__deferred”: {
    “uri”: “https://abccre.sharepoint.com/projects/_api/Web/Fields”
    }
    },
    “Folders”: {
    “__deferred”: {
    “uri”: “https://abccre.sharepoint.com/projects/_api/Web/Folders”
    }
    },
    “HostedApps”: {
    “__deferred”: {
    “uri”: “https://abccre.sharepoint.com/projects/_api/Web/HostedApps”
    }
    },
    “Lists”: {
    “__deferred”: {
    “uri”: “https://abccre.sharepoint.com/projects/_api/Web/Lists”
    }
    },
    “ListTemplates”: {
    “__deferred”: {
    “uri”: “https://abccre.sharepoint.com/projects/_api/Web/ListTemplates”
    }
    },
    “Navigation”: {
    “__deferred”: {
    “uri”: “https://abccre.sharepoint.com/projects/_api/Web/Navigation”
    }
    },
    “OneDriveSharedItems”: {
    “__deferred”: {
    “uri”: “https://abccre.sharepoint.com/projects/_api/Web/OneDriveSharedItems”
    }
    },
    “ParentWeb”: {
    “__deferred”: {
    “uri”: “https://abccre.sharepoint.com/projects/_api/Web/ParentWeb”
    }
    },
    “PushNotificationSubscribers”: {
    “__deferred”: {
    “uri”: “https://abccre.sharepoint.com/projects/_api/Web/PushNotificationSubscribers”
    }
    },
    “RecycleBin”: {
    “__deferred”: {
    “uri”: “https://abccre.sharepoint.com/projects/_api/Web/RecycleBin”
    }
    },
    “RegionalSettings”: {
    “__deferred”: {
    “uri”: “https://abccre.sharepoint.com/projects/_api/Web/RegionalSettings”
    }
    },
    “RoleDefinitions”: {
    “__deferred”: {
    “uri”: “https://abccre.sharepoint.com/projects/_api/Web/RoleDefinitions”
    }
    },
    “RootFolder”: {
    “__deferred”: {
    “uri”: “https://abccre.sharepoint.com/projects/_api/Web/RootFolder”
    }
    },
    “SiteCollectionAppCatalog”: {
    “__deferred”: {
    “uri”: “https://abccre.sharepoint.com/projects/_api/Web/SiteCollectionAppCatalog”
    }
    },
    “SiteGroups”: {
    “__deferred”: {
    “uri”: “https://abccre.sharepoint.com/projects/_api/Web/SiteGroups”
    }
    },
    “SiteUserInfoList”: {
    “__deferred”: {
    “uri”: “https://abccre.sharepoint.com/projects/_api/Web/SiteUserInfoList”
    }
    },
    “SiteUsers”: {
    “__deferred”: {
    “uri”: “https://abccre.sharepoint.com/projects/_api/Web/SiteUsers”
    }
    },
    “TenantAppCatalog”: {
    “__deferred”: {
    “uri”: “https://abccre.sharepoint.com/projects/_api/Web/TenantAppCatalog”
    }
    },
    “ThemeInfo”: {
    “__deferred”: {
    “uri”: “https://abccre.sharepoint.com/projects/_api/Web/ThemeInfo”
    }
    },
    “TitleResource”: {
    “__deferred”: {
    “uri”: “https://abccre.sharepoint.com/projects/_api/Web/TitleResource”
    }
    },
    “UserCustomActions”: {
    “__deferred”: {
    “uri”: “https://abccre.sharepoint.com/projects/_api/Web/UserCustomActions”
    }
    },
    “Webs”: {
    “__deferred”: {
    “uri”: “https://abccre.sharepoint.com/projects/_api/Web/Webs”
    }
    },
    “WebInfos”: {
    “__deferred”: {
    “uri”: “https://abccre.sharepoint.com/projects/_api/Web/WebInfos”
    }
    },
    “WorkflowAssociations”: {
    “__deferred”: {
    “uri”: “https://abccre.sharepoint.com/projects/_api/Web/WorkflowAssociations”
    }
    },
    “WorkflowTemplates”: {
    “__deferred”: {
    “uri”: “https://abccre.sharepoint.com/projects/_api/Web/WorkflowTemplates”
    }
    },
    “AllowRssFeeds”: true,
    “AlternateCssUrl”: “”,
    “AppInstanceId”: “00000000-0000-0000-0000-000000000000”,
    “Configuration”: 0,
    “Created”: “2013-07-21T13:55:01”,
    “CurrentChangeToken”: {
    “__metadata”: {
    “type”: “SP.ChangeToken”
    },
    “StringValue”: “1;2;71d3c1b8-2576-411f-a99f-2f93ce62707d;636789455544700000;102247947”
    },
    “CustomMasterUrl”: “/projects/_catalogs/masterpage/seattle.master”,
    “Description”: “ABCO Active Projects”,
    “DesignPackageId”: “00000000-0000-0000-0000-000000000000”,
    “DocumentLibraryCalloutOfficeWebAppPreviewersDisabled”: false,
    “EnableMinimalDownload”: true,
    “FooterEnabled”: false,
    “HeaderEmphasis”: 0,
    “HeaderLayout”: 0,
    “HorizontalQuickLaunch”: false,
    “Id”: “71d3c1b8-2576-411f-a99f-2f93ce62707d”,
    “IsMultilingual”: false,
    “Language”: 1033,
    “LastItemModifiedDate”: “2018-11-27T19:35:39Z”,
    “LastItemUserModifiedDate”: “2018-11-27T19:35:39Z”,
    “MasterUrl”: “/projects/_catalogs/masterpage/seattle.master”,
    “MegaMenuEnabled”: false,
    “NoCrawl”: false,
    “ObjectCacheEnabled”: false,
    “OverwriteTranslationsOnChange”: false,
    “ResourcePath”: {
    “__metadata”: {
    “type”: “SP.ResourcePath”
    },
    “DecodedUrl”: “https://abccre.sharepoint.com/projects”
    },
    “QuickLaunchEnabled”: true,
    “RecycleBinEnabled”: true,
    “ServerRelativeUrl”: “/projects”,
    “SiteLogoUrl”: “/SiteAssets/AB-logo-red-med.gif”,
    “SyndicationEnabled”: true,
    “Title”: “Projects”,
    “TreeViewEnabled”: false,
    “UIVersion”: 15,
    “UIVersionConfigurationEnabled”: false,
    “Url”: “https://abccre.sharepoint.com/projects”,
    “WebTemplate”: “STS”,
    “WelcomePage”: “SitePages/Home.aspx”
    }
    }J-3A20040-WE

    1. Hi Shane,

      You cannot call a get method in your browser.

      If you try to do this within Flow are you able to create a site? If not what are the errors that you are seeing in Flow?

      1. The error message I get is:

        “status”: 400,
        “message”: “Not well formatted JSON stream.\r\nclientRequestId: e85cfdf3-9b43-4ce2-8a32-e85c6337ea62\r\nserviceRequestId: 7cd5a69e-f066-7000-7263-3b631b30c678”,
        “source”: “https://abccre.sharepoint.com/projects/_api/web/webinfos/add”,
        “errors”: [
        “-1”,
        “Microsoft.SharePoint.Client.InvalidClientQueryException”
        ]
        }

      2. I’m sure its because I’m not using the correct details from the Get function when I ran it – I’m just not sure what details to use in the Post function?

      3. { ‘parameters’:
        { ‘__metadata’:
        { ‘type’: ‘SP.Web’ },
        ‘Url’:@{triggerBody()[‘Job_x0020_Number’]},
        ‘Title’:@{triggerBody()[‘Title’]},
        ‘Description’:@{triggerBody()[‘Project_x0020_Description’]},
        ‘Language’:’1033′,
        ‘WebTemplate’:’Projecttemplate’,
        ‘UseUniquePermissions’:false
        }
        }

        Thx!

      4. HI Shane,

        The WebTemplate needs to be using the Template IDs. Projecttemplate will not work. See https://absolute-sharepoint.com/2013/06/sharepoint-2013-site-template-id-list-for-powershell.html

        Also, I wonder if the single quotes were messed up. This can happen with copy past from blogs.

        Then finally the type needs to be set to SP.WebInfoCreationInformation

        So more like this:

        { ‘parameters’:
        { ‘__metadata’:
        { ‘type’: ‘SP.WebInfoCreationInformation’ },
        ‘Url’:’testsiteflow2′,
        ‘Title’:’My Title2′,
        ‘Description’:’My Description’,
        ‘Language’:’1033′,
        ‘WebTemplate’:’STS#0′,
        ‘UseUniquePermissions’:false
        }
        }

  14. Hi Pieter,

    Thanks for the tips!
    Actually I managed to create the subsite with a custom template, but the flow always finish with error “502…url alredy in use etc etc”, is it normal?

      1. SUre,

        This is the Body of the HTTP request (POST)

        { ‘parameters’:
        { ‘__metadata’:
        { ‘type’: ‘SP.WebInfoCreationInformation’ },
        ‘Url’:’site_test’,
        ‘Title’:’title_test’,
        ‘Description’:’abc’,
        ‘Language’:’3082′,
        ‘WebTemplate’:'{BD893029-F5A1-4009-9F6B-39185C3BFADC}#template_custom_2′,
        ‘UseUniquePermissions’:false
        }
        }

        ————————————
        this is the Output message

        {
        “error”: {
        “code”: 502,
        “source”: “brazil-001.azure-apim.net”,
        “clientRequestId”: “09b13443-9c4b-472d-9968-08df01c3f7fb”,
        “message”: “BadGateway”,
        “innerError”: {
        “status”: 502,
        “message”: “The Web site address \”/sites/testsitecollection/site_test\” is already in use.\r\nclientRequestId: 09b13443-9c4b-472d-9968-08df01c3f7fb\r\nserviceRequestId: ef7bbd9e-d0a8-0000-25bc-3210f9a6b940″,
        “source”: “https://*******.sharepoint.com/sites/testsitecollection/_api/web/webinfos/add”,
        “errors”: [
        “-2147024713”,
        “Microsoft.SharePoint.SPException”
        ]
        }
        }
        }

        But the flow creates the site, which is weird.

      2. Hi Feibein,

        That error is saying that the site already exists. It looks like there are either multiple flows kicking off (and second one is failing with he error) or the site already exists when you attempt to create a new one.

  15. Actually when the flow reach the Post step, there are 4 retries before it fails. Maybe increasing the duration time?

  16. Hi @Pieter

    Is there any possibility to delete a node ?

    i would like to delete the default “notebook” node in a TeamsSite because I take care of provisioning this notebook with Graph.

    The default node/url for “notebook” has the wired url :

    I tryed with POST but the result is the creation of a new node and not an update of the existing node

    My code :

    /_api/web/Navigation/QuickLaunch

    { ‘__metadata’:
    { ‘type’: ‘SP.NavigationNode’ },
    ‘IsExternal’: false,
    ‘Title’: “Notebook”,
    ‘Url’: “http://portal.office.com”
    }

    Many thx for your help 🙂

    1. Hi Hadrien,

      It all depends a bit on how you provision your site. I often use PnP (PowerShell or Core) to look after my provisioning. The notebook link in the navigation is only a link. At the creation of the site there isn’t a notebook there. Therefore you only need to worry about removing the link form the navigation during the provisioning. Quite often I set my navigation links to clear before the provisioning then recreates all the links.

      1. Thx for your feedback 🙂
        In my case the provisioning is done by Flow with MS Graph (cloning Teams)

        Is there any workaround to update or clear links with SPO API after the provisioning or it is not possible to clear QuickLaunch from SPO API ?

  17. Ok that’s a sad news 🙁 Azure Function = consumption azure and that’s exactly what i would like to avoid.

    Thx anyway for your fast answers 😉

  18. Getting below error, while creating a new subsite inside site collection:

    {
    “error”: {
    “code”: 502,
    “source”: “flow-apim-msmanaged-na-eastus2-01.azure-apim.net”,
    “clientRequestId”: “fe8bfa02-8ddd-4e76-a3a2-68b4cdad057b”,
    “message”: “BadGateway”,
    “innerError”: {
    “message”: “\”sites\todayflow\” contains invalid character ‘\t’.\r\nclientRequestId: fe8bfa02-8ddd-4e76-a3a2-68b4cdad057b\r\nserviceRequestId: a143dc9e-8070-0000-3801-b41459dba6b6″,
    “status”: 502,
    “source”: “https://abc.sharepoint.com/_api/web/webinfos/add”,
    “errors”: [
    “-2146232832”,
    “Microsoft.SharePoint.SPException”
    ]
    }
    }
    }

    1. The sites under /sites are site collections not subsites. I had a look at options for creating site collections form Flow.

      I would probably go for the creation of an Azure function and PnP PowerShell.

      Then call the Azure function from a flow.

  19. Hi, Pieter.
    I tried to set “UseUniquePermissions: true’ and was able to create a SharePoint group but will need to assign the new Owners group into the sub-site.

    _api/web/sitegroups <- new Owners group
    _api/web/sitegroups(Id)/users <- added user to the Owners group

    Would it be better to use the BreakRoleInheritance instead? Thanks!

    Fred

  20. How can I associate newly created SharePoint permission groups into the sub-site? What is the REST API call if I use the unique permission? Thanks!

  21. Peter,
    The URI you’re looking for is:
    _api/web/roleassignments/addroleassignment(Principalid=,roledefid=1073741829)

    I’m currently stuck in it producing a null result, however this is as far as I have gotten. The flow does run, perhaps it’s a start?

  22. Hello

    I am using same action to create site, I have started seeing below 2 issues:
    1. Gateway Timeout
    2. Bad gateway

    it creates sites but again retries to create site again.
    Sometimes does not create site gives error.
    Site got created and retries and gives error.

    not sure why i am seeing this behavior.

    Please help.

    1. Most likely the first attempt to create the site takes too long. Then the retry will fail as the url is already in use. These issues can be tricky to resolve. I would at least disable the retry there.

Leave a Reply

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

Discover more from SharePains by Microsoft MVP Pieter Veenstra

Subscribe now to keep reading and get access to the full archive.

Continue reading