Create a new sub site using Microsoft Flow!

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.

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

Then once again set the headers.

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 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.

At hybrIT Services I implemented some of these site creation processes in the past. But it was never this easy as it is with Microsoft Flow.

65 thoughts on “Create a new sub site using Microsoft Flow!

  1. commented on May 3, 2018 by nigelpwordpress

    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 !

    • commented on May 3, 2018 by Pieter Veenstra

      Hi Nigel,

      That is right! I stopped using SPD for a while now. The only need for SPD is in the on-premises world.

  2. commented on May 3, 2018 by Art

    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

    • commented on May 3, 2018 by Pieter Veenstra

      Hi Art,
      It only arrived yesterday for me. I do have targeted release switched on. So you might have to wait a few days for this to arrive.

  3. Hier Pieter , did you try to create a modern site? would it be different (given that it is a site collection?

    • commented on May 17, 2018 by Pieter Veenstra

      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.

  4. commented on May 23, 2018 by Chad

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

    • 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.

  5. commented on May 25, 2018 by Miles

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

    Thanks

    Miles

  6. commented on July 17, 2018 by Mario

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

  7. commented on August 5, 2018 by Mark Vogt

    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

    • HI Mark, When I hit these kind of problem I often go to the REST API url in my browser. Quite often it then shows the fields names etc.

  8. commented on August 5, 2018 by Mark Vogt

    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

  9. commented on August 8, 2018 by karthick

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

  10. commented on August 17, 2018 by Jan

    Hi Pieter. Is there a way how to use custom site template saved in solutions?

  11. commented on September 10, 2018 by Karthick

    Hi Pieter Veenstra,
    How to Create Team Site Using Flow i .e https://abc.sharepoint.com/sites/(Team Site Name).

    • I would probably try to do this with Flow calling Azure Functions. Then you can do the job of site creation using PowerShell

  12. commented on September 19, 2018 by Steve Bammer

    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!

  13. commented on September 19, 2018 by Steve Bammer

    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!

    • Hi Steve,
      I can’t see a reason why you couldn’t use Flow. Yes you could use Nintex but i don’t see any real benefit in doing so.

  14. commented on October 22, 2018 by Brad

    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

  15. commented on November 8, 2018 by Jason

    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?

  16. commented on November 27, 2018 by Shane Alexander

    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

    • 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?

      • commented on November 28, 2018 by Shane Alexander

        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”
        ]
        }

      • Can you send me the body of the post action as well please?

      • commented on November 28, 2018 by Shane Alexander

        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?

      • commented on November 28, 2018 by Shane Alexander

        { ‘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!

      • 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
        }
        }

  17. commented on February 7, 2019 by Feibien

    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?

    • Hi,

      can you send me more details of the error from the flow run history? You shouldn’t get an error.

      • commented on February 8, 2019 by Feibien

        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.

      • 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.

  18. commented on February 8, 2019 by Feibien

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

    • commented on February 9, 2019 by Feibien

      Increasing the duration solved the issue. Thanks!

  19. commented on April 15, 2019 by HNS

    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 🙂

    • 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.

      • commented on April 15, 2019 by HNS

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

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

      • You could call an Azure Function that cleans things up using PnP PowerShell.

  20. commented on April 15, 2019 by HNS

    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 😉

  21. commented on May 13, 2019 by indianatul

    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”
    ]
    }
    }
    }

  22. commented on May 13, 2019 by indianatul

    Got same error with also,

    want to create a new site under https://abc.sharepoint.com/sites/……(new site)

    • commented on May 13, 2019 by Pieter Veenstra

      can you send a screen shot of the action in edit mode to contact@veenstra.me.uk

    • commented on May 14, 2019 by Pieter Veenstra

      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.

  23. commented on September 26, 2019 by FYano

    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

    • Hi Fred,

      That totally depends on what you want to use as a base for your site security. Break Role Inheritance will use the permissions of the parent site as a default.

  24. commented on October 1, 2019 by FYano

    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!

Leave a Reply

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

%d bloggers like this: