0

I have a user who I do not want to promote to a SharePoint Administrator, but I do want to allow them (because they are a developer) to create site collections with the template DEV#0 without having to go through me or my account I know I can set up an application that allows them to do this by using the permissions of the application, but before I do this, I just wanted to confirm that there is no way for a user to do this in SharePoint Online.

  • I can't use SPO Powershell because they do not have access to the admin center.
  • I can't use New-PnPTenantSite because they do not have access to the admin center.
  • I tried using the SharePoint Rest API, and here was the code I tried under their account from the JavaScript console at https://tenant.sharepoint.com/_layouts/15/sharepoint.aspx (I used JavaScript fetch for this test):

Request:

fetch("https://tenant.sharepoint.com/_api/SPSiteManager/Create", {
"headers": {
"accept": "application/json;odata=verbose",
"accept-language": "en-US,en;q=0.9",
"content-type": "application/json;odata=verbose",
"sec-fetch-dest": "empty",
"sec-fetch-mode": "cors",
"sec-fetch-site": "same-origin",
"x-requestdigest": "Request_Digest_Here"
},
"body": "{\"request\":{\"__metadata\":{\"type\":\"Microsoft.SharePoint.Portal.SPSiteCreationRequest\"},\"WebTemplate\":\"DEV#0\",\"Title\":\"Test dev site\",\"Url\":\"https://tenant.sharepoint.com/sites/devsite1\",\"Description\":\"\",\"Classification\":\"\",\"Lcid\":1033,\"ShareByEmailEnabled\":false,\"WebTemplateExtensionId\":\"00000000-0000-0000-0000-000000000000\",\"HubSiteId\":\"00000000-0000-0000-0000-000000000000\"}}",
"method": "POST",
"mode": "cors",
"credentials": "include"
});

Response:

{"error":{"code":"-2147024809, System.ArgumentException","message":{"lang":"en-US","value":"siteTemplate\r\nParameter name: Performing this operation on a site with this template is not allowed."}}}
  • I can't use CSOM because I can't create a Tenant object to use the Tenant.CreateSite method without the account being a SharePoint administrator.
  • Correct me if I'm wrong, but I don't think there is a way to create a site collection in JSOM.
  • Is it possible to use WSDL/SharePoint SOAP API?

Am I missing any methods? Is it possible to use the SOAP API or JSOM? Can I resolve the error in the REST API? Or is this just not possible?

0

This is just not possible. If the users donot have access to the admin center, they can only create site collections with modern template(communication sites and team sites).

The rest api you used is only available for Communication sites and non-group associated Team Sites.https://docs.microsoft.com/en-us/sharepoint/dev/apis/site-creation-rest

To create site collections with the template DEV#0, you have to give them admin-center access.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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