0

I'm trying to create a new site collection in sharepoint 2019 with the api _api/SPSiteManager/create. The only template i can choose are STS#3 and SITEPUBLISHING#0. If I choose any other template it will tell me :

"Performing this operation on a site with this template is not allowed."

Is there a way to create a new site collection with a custom template via api?

5
  • How you have created custom template ? it's using Site Definition concept (Farm Solution) or you are using Web Template (using Sandbox solution)? Commented Mar 1, 2023 at 7:11
  • I have an exported custom template that is a WebTemplate, it's a .wsp file.
    – forsus
    Commented Mar 1, 2023 at 14:31
  • How you are using API? I meant using C# code or using any other approach? Commented Mar 2, 2023 at 4:26
  • I'am using curl and javascript
    – forsus
    Commented Mar 2, 2023 at 10:31
  • I've managed to create a sitecollection with a custom Template, for everyone interested: this can't be done via client side api but only from the server side. I've created a Console Application in Visual Studio with this code: link
    – forsus
    Commented Mar 8, 2023 at 9:20

1 Answer 1

0

can you provide your HTTP header and body? I am trying to create a new site collection with just the STS#3 template since days now in SharePoint 2019 using the endpoint _api/SPSiteManager/create, but it won't work. Always getting SiteStatus 3 as response.

My current body looks like this:

{
  "request": {
    "Title": "Test Site",
    "Url":"https://mylocalurl/websites/Test",
    "Lcid": 1031,
    "Description": "",
    "WebTemplate":"STS#3",
    "ShareByEmailEnabled":false,
    "Classification":"",
    "SiteDesignId":"f6cc5403-0d63-442e-96c0-285923709ffc",
    "WebTemplateExtensionId":"00000000-0000-0000-0000-000000000000"
  }
}

Any help would be appreciated.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.