Skip to main content

Modern SharePoint site creation with REST API.

The following REST commands are available for creating a modern SharePoint Communication site:
  • Create. Create a new SharePoint site.
  • Delete. Deletes a SharePoint site.
  • Status. Get the status of a SharePoint site.
The base URL for the REST commands is _api/SPSiteManager.

Create a modern site

Using the following REST api you can create both Communication sites and non-group associated Team Sites.
To specify which type of site to create you use the WebTemplate attribute. Use one of the following templates to select which type of site to create:
  • Communication Site: SITEPAGEPUBLISHING#0
  • non-group associated Team Site: STS#3

JSON


url: /_api/SPSiteManager/create
accept: application/json;odata.metadata=none
odata-version: 4.0
method: POST
body:
{
  "Title": "Communication Site 1",
  "Url":"https://contoso.sharepoint.com/sites/commsite1",
  "Lcid": 1033,
  "ShareByEmailEnabled":false,
  "Classification":"Low Business Impact",
  "Description":"Description",
  "WebTemplate":"SITEPAGEPUBLISHING#0",
  "SiteDesignId":"6142d2a0-63a5-4ba0-aede-d9fefca2c767",
  "Owner":"owner@yourtenant.onmicrosoft.com"
}

Response

If successful, this method returns a 200, OK response code and simple JSON object in the response body with the following details.
JSON
{
  "SiteId":"d11e59ca-1465-424c-be90-c847ba849af5",
  "SiteStatus":2,
  "SiteUrl":"https://contoso.sharepoint.com/sites/commsite1"
}

Delete a modern site

The REST API to delete a modern site is:
JSON
url: /_api/SPSiteManager/delete
method: POST
accept: application/json;odata.metadata=none
odata-version: 4.0
body:
{
  "siteId":"d11e59ca-1465-424c-be90-c847ba849af5"
}

Response

If successful this method returns a 200, OK response code.

Comments

  1. I have appeared in many IT certification exams but did not find any material like AZ-300 Dumps. It is the most reliable and concise exam material which gives a full understanding of the syllabus topics. Once I went through the dumps material I got a full view of the field and was able to solve all the questions in the final.

    ReplyDelete

Post a Comment