Add-SPOSiteScript

Uploads a new site script for use either directly or in a site design.

Syntax

Add-SPOSiteScript
   -Title <string>
   -Content <string>
   [-Description <string>]
   [<CommonParameters>]

Description

Uploads a new site script for use either directly or in a site design.

Examples

Example 1

This example adds a new site logo from the following script in a file.

{
  "$schema": "schema.json",
  "actions": [
      {
        "verb": "setSiteLogo",
        "url": "https://contoso.sharepoint.com/SiteAssets/company-logo.png"
      }
  ]
}

Get-Content 'c:\scripts\site-script.json' -Raw | Add-SPOSiteScript -Title "Customer logo" -Description "Applies customer logo for customer sites"

Example 2

This example sets the external sharing capabilities of the site to the ExternalUserAndGuestSharing option. We also add a site design for a Communication site (68) which uses this script.

$script = @'
{
     "$schema": "schema.json",
         "actions": [
 {
    "verb": "setSiteExternalSharingCapability",
    "capability": "ExternalUserAndGuestSharing"
 }
         ],
         "bindata": { },
         "version": 1
 };
'@

Add-SPOSiteScript -Title "External User and Guest Sharing site script" -Description "A site script to manage the
guest access of a site" -Content $script

Id          : ea9e3a52-7c12-4da8-a901-4912be8a76bc
Title       : External User and Guest Sharing site script
Description : A site script to manage theguest access of a site
Content     :
Version     : 0

Add-SPOSiteDesign -Title "Communication Site with External Users and Guest Sharing" -WebTemplate "68" -SiteScripts "ea9e3a52-7c12-4da8-a901-4912be8a76bc"

Parameters

-Content

The JSON value that describes the script. For more information, see the JSON reference.

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False
Applies to:SharePoint Online

-Description

A description of the script.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False
Applies to:SharePoint Online

-Title

The display name of the site design.

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False
Applies to:SharePoint Online