Skip to main content
Version: 2.550.0

New SharePoint site

The EasyLife 365 Collaboration API empowers users to create SharePoint sites effortlessly. These sites are fashioned based on pre-existing templates and their associated policies.

info

The chosen template dictates whether the created resource will be a SharePoint Team Site or a SharePoint Communication Site.

Permissions

Permission TypePermissions (Scope)
Delegated (work or school account)https://api.easylife365.cloud/collab/App.ReadWrite.All
ApplicationNot supported.

HTTP Request

POST https://api.easylife365.cloud/collab/v1/spo/
Content-Type: application/json

HTTP Request Headers

HeaderValue
AuthorizationBearer token. (Required)
Content-Typeapplication/json

Request Body

PropertyTypeDescription
displayNameStringName of the SharePoint site. (Required)
descriptionStringDescription of the SharePoint site. (Optional)
templateIdStringTemplate identifier. (Required)
aliasStringAlias of the SharePoint site. (Optional)
ownersArray of StringList of owners of the group. (Optional) The requester is automatically added.
metadataObjectList of key/value pairs representing additional information. (Optional)
labelIdStringSensitivity labelId for the group. (Optional)

Response

Upon queuing the request, the API will respond with the following payload:

{
"requestId": "72d2f4b8-76fe-4140-9460-3c7ef9091cb5",
"tenantId": "1840b34e-6fe7-4a56-9ad3-0b7b58c49dc7",
"approvalRequired": false
}

The requestId serves as a unique identifier to track all activities related to the provisioning process. When a new resource is created, the corresponding provisioning webhook—configured in the template—receives a payload that includes this requestId.

As part of the provisioning process, EasyLife 365 creates a Security Group linked to the provisioned SharePoint Site. This group is typically available within 15–20 seconds after the provisioning is complete via the EasyLife API.

To ensure reliable access to the provisioned group, we recommend implementing a polling mechanism as follows:

  • Start polling: 20 seconds after the initial provisioning request
  • Retry interval: Every 10 seconds
  • Fallback timeout: Stop polling after 30 seconds if the group is not yet available

You can retrieve the provisioned group using the Microsoft Graph API with the following query (replace the requestId with your requestId):

GET https://graph.microsoft.com/v1.0/groups?$filter=easylife365_group/requestId eq '72d2f4b8-76fe-4140-9460-3c7ef9091cb5'&$select=id,displayName,easylife365_group
Content-Type: application/json

Example response

{
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#groups(id,displayName,easylife365_group)",
"value": [
{
"id": "b5967fe9-fc1b-4415-9103-04694c79a758",
"displayName": "SG_EL_SPO_cc99d8a0_bb8d_4784_9ff6_841623e4458b",
"easylife365_group": {
"extensionAttribute1": "cc99d8a0-bb8d-4784-9ff6-841623e4458b",
"extensionAttribute3": "https://nuborocks.sharepoint.com/sites/sharepointsite"
}
}
]
}
  • extensionAttribute1: Contains the Graph Site ID associated with the SharePoint site.
  • extensionAttribute3: Contains the URL of the provisioned SharePoint site.

Example 1: Create a SharePoint Site

The following sample creates a SharePoint site with two owners. The user initiating the call will automatically become an owner.

POST https://api.easylife365.cloud/collab/v1/spo/
Content-Type: application/json
{
"displayName": "My Demo SharePoint Site",
"description": "A demonstration of SharePoint site creation via the API.",
"templateId": "fc6ffbd8-f7f0-4c05-b707-227d233b9e1b",
"alias": "",
"owners": [
"49cf935a-284f-4c84-8df7-a5b11f1be527",
"6a95c23b-cbb3-4f06-9b05-5e96ac65c78c"
],
"metadata": {
"el-text-388": "Custom text field content goes here!"
}
}

Example 2: Create a SharePoint Site using PowerShell

The next example illustrates creating a SharePoint site using PowerShell. Prior to execution, ensure you've registered an application and obtained the TenantId and ClientId. Additionally, retrieve the correct scope from this document.

Import-Module MSAL.PS

$msalParam = @{
tenantId = "[TENANT_ID]"
clientId = "[CLIENT_ID]"
scopes = "[SCOPE]"
}

# Get JWT authentication token.
if($token){
$token = Get-MsalToken @msalParam -Silent
} else {
$token = Get-MsalToken @msalParam -DeviceCode
}

# Create object with values to pass to the API.
$uri = "https://api.dev.easylife365.cloud/collab/v1/spo/"

$body = @{
displayName = "My Demo SharePoint Site"
description = "A demonstration of SharePoint site creation via the API."
templateId = "fc6ffbd8-f7f0-4c05-b707-227d233b9e1b"
alias = ""
owners= @("49cf935a-284f-4c84-8df7-a5b11f1be527", "6a95c23b-cbb3-4f06-9b05-5e96ac65c78c")
metadata = @{
"el-text-388" = "Custom text field content goes here!"
}
}

# Invoke the API and capture responses.
$jsonBody = $body | ConvertTo-Json -Depth 5 -Compress
$encodedBody = [System.Text.Encoding]::UTF8.GetBytes($jsonBody)

$headers = @{
"Authorization"="Bearer $($token.AccessToken)"
"Content-Type" = "application/json"
}

Write-Information "Creating SharePoint site with: $jsonBody" -InformationAction Continue
$response = Invoke-RestMethod -Method post -Uri $uri -Headers $headers -Body $encodedBody
$response