Share via


Add-SPOSiteScript

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

Syntax

Default (Default)

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

Applicable: SharePoint Online

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

Parameter properties

Type:System.String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:True
Value from pipeline:True
Value from pipeline by property name:False
Value from remaining arguments:False

-Description

Applicable: SharePoint Online

A description of the script.

Parameter properties

Type:System.String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Title

Applicable: SharePoint Online

The display name of the site design.

Parameter properties

Type:System.String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

Inputs

System.String

Outputs

System.Object