web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Error when using HTTP ...
Power Automate
Unanswered

Error when using HTTP to create a new subsite in SharePoint Online

(0) ShareShare
ReportReport
Posted on by

Hi,

 

Relatively new to Flow & REST API logic, so apologies if this a) has already been asked, or b) if this is an elementary question!

 

Having successfully built in SharePoint Designer using the Call HTTP function, I'm now trying to replicate the logic of creating a new subsite, in a different site collection, when a user submits a request to an SP list.

 

Within my Flow I have a HTTP component, set up as follows:

 

Method: POST
Uri: https://<site collection address of where the subsite is to be made>/_api/web/webinfos/add

Headers: Accept & Content Type, both with the standard application/json;odata=verbose

Body:

 

{

"parameters": {

     "Url": "project1",

     "Title": "Project One",

     "Description": "A description of Project One",

     "Language": "1033",

     "WebTemplate": "STS#0",

     "UseUniquePermissions": true,

     "__metadata": {"type": "SP.WebInfoCreationInformation"}

      }

}

(my body is hard coded for now to test the logic, after which I will pull the fields from the SP list to populate accordingly)

 

In my Advanced Options, I am using Basic Authentication & have applied the username & password of a service account that is a site collection administrator (and indeed a Global Admin acc for our O365 domain).

 

Running the above gives me the following error:

 

{"error":{"code":"-2147024891, System.UnauthorizedAccessException","message":{"lang":"en-US","value":"Access denied. You do not have permission to perform this action or access this resource."}}}

 

I was used to seeing this when developing this in SharePoint Designer, the well-known fix of specifying the WF Apps Permission Request in XML & trusting said App meant that exactly the same HTTP build has worked fine in SharePoint Online, having registered the workflow GUID & applied the XML logic of Scope="http://sharepoint/content/tenant" Right="FullControl".

 

Is there something similar I need to do for this call to be accepted from Flow to SharePoint Online, or have I missed a vital step in Flow?

 

Any insight, help or tips would be most appreciated.

 

Thanks

Categories:
I have the same question (0)
  • v-monli-msft Profile Picture
    on at
    Re: Error when using HTTP to create a new subsite in SharePoint Online

    Hi @Anonymous,

     

    I have escalated this issue to the product team and will get back once I received any update.

     

    Regards,

    Mona

  • Community Power Platform Member Profile Picture
    on at
    Re: Error when using HTTP to create a new subsite in SharePoint Online

    Thanks @v-monli-msft, much appreciated & look forward to receiving a response in due course

  • Community Power Platform Member Profile Picture
    on at
    Re: Error when using HTTP to create a new subsite in SharePoint Online

    Hi @v-monli-msft

     

    Is there any feedback on this yet?

     

    Thanks

  • azabel Profile Picture
    2 on at
    Re: Error when using HTTP to create a new subsite in SharePoint Online

    In my requestHeaders Dictionary, I had to add the following to get this to work:

     

    Name: Authorization

    Type: String

    Value: 

     

    The value left blank

     

    This zero's out the authorization header and it no longer complains

  • Community Power Platform Member Profile Picture
    on at
    Re: Error when using HTTP to create a new subsite in SharePoint Online

    That seems to work fine in SharePoint Designer but not in MS Flow. I've put what you suggested in the "Headers" section of the HTTP call, but without success (have since removed this addition)

     

    MSFLOW_CREATESITE.png

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Tomac Profile Picture

Tomac 497 Moderator

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 477 Super User 2025 Season 2

#3
chiaraalina Profile Picture

chiaraalina 242

Last 30 days Overall leaderboard