Get-SPOSiteScriptFromWeb

Creates site script syntax from an existing SharePoint site.

Syntax

Get-SPOSiteScriptFromWeb
   [-WebUrl] <string>
   [-IncludedLists <string[]>]
   [-IncludeBranding]
   [-IncludeTheme]
   [-IncludeRegionalSettings]
   [-IncludeSiteExternalSharingCapability]
   [-IncludeLinksToExportedItems]
   [<CommonParameters>]

Description

Uses an existing SharePoint site to output a JSON blob that can be used to create a site script for use in a site design.

Examples

Example 1

This example creates the site script output from an existing site - and writes it to a variable. This variable is then referenced to create a site script.

C:\> $extracted = Get-SPOSiteScriptFromWeb `
    -WebUrl https://contoso.sharepoint.com/sites/template `
    -IncludeBranding `
    -IncludeTheme `
    -IncludeRegionalSettings `
    -IncludeSiteExternalSharingCapability `
    -IncludeLinksToExportedItems `
    -IncludedLists ("Shared%20Documents", "Lists/Project%20Activities")
C:\> Add-SPOSiteScript `
    -Title "Contoso template site" `
    -Description "This is a copy of a site collection." `
    -Content $extracted

Parameters

-IncludeBranding

A switch that if provided, extracts the configuration of the site's branding.

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

-IncludedLists

An array of one or more lists. Each is identified by the list url.

Note: Currently, navigation nodes are not exported.

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

-IncludeLinksToExportedItems

A switch that if provided, extracts navigation links. In order to export navigation links pointing to lists, the list needs to be included in the request as well.

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

-IncludeRegionalSettings

A switch that if provided, extracts the site's regional settings.

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

-IncludeSiteExternalSharingCapability

A switch that if provided, extracts the site's external sharing capability.

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

-IncludeTheme

A switch that if provided, extracts the site's custom theme by using the themeJson property.

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

-WebUrl

The url that starts with HTTPS of the site to retrieve the site script.

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