Get-PnPSiteTemplate
SYNOPSIS
Generates a provisioning site template from a web
SYNTAX
Get-PnPSiteTemplate [[-Out] <String>] [[-Schema] <XMLPnPSchemaVersion>] [-IncludeAllTermGroups]
[-IncludeSiteCollectionTermGroup] [-IncludeSiteGroups] [-IncludeTermGroupsSecurity]
[-IncludeSearchConfiguration] [-PersistBrandingFiles] [-PersistPublishingFiles]
[-IncludeNativePublishingFiles] [-IncludeHiddenLists] [-IncludeAllClientSidePages] [-SkipVersionCheck]
[-PersistMultiLanguageResources] [-ResourceFilePrefix <String>] [-Handlers <Handlers>]
[-ExcludeHandlers <Handlers>] [-ExtensibilityHandlers <ExtensibilityHandler[]>]
[-TemplateProviderExtensions <ITemplateProviderExtension[]>] [-ContentTypeGroups <String[]>] [-Force]
[-NoBaseTemplate] [-Encoding <Encoding>] [-TemplateDisplayName <String>] [-TemplateImagePreviewUrl <String>]
[-TemplateProperties <Hashtable>] [-OutputInstance] [-ExcludeContentTypesFromSyndication]
[-ListsToExtract <System.Collections.Generic.List`1[System.String]>]
[-Configuration <ExtractConfigurationPipeBind>] [-Web <WebPipeBind>] [-Connection <PnPConnection>] [-WhatIf]
[-Confirm] [<CommonParameters>]
DESCRIPTION
EXAMPLES
EXAMPLE 1
Get-PnPSiteTemplate -Out template.pnp
Extracts a provisioning template in Office Open XML from the current web.
EXAMPLE 2
Get-PnPSiteTemplate -Out template.xml
Extracts a provisioning template in XML format from the current web.
EXAMPLE 3
Get-PnPSiteTemplate -Out template.pnp -Schema V201503
Extracts a provisioning template in Office Open XML from the current web and saves it in the V201503 version of the schema.
EXAMPLE 4
Get-PnPSiteTemplate -Out template.pnp -IncludeAllTermGroups
Extracts a provisioning template in Office Open XML from the current web and includes all term groups, term sets and terms from the Managed Metadata Service Taxonomy.
EXAMPLE 5
Get-PnPSiteTemplate -Out template.pnp -IncludeSiteCollectionTermGroup
Extracts a provisioning template in Office Open XML from the current web and includes the term group currently (if set) assigned to the site collection.
EXAMPLE 6
Get-PnPSiteTemplate -Out template.pnp -PersistBrandingFiles
Extracts a provisioning template in Office Open XML from the current web and saves the files that make up the composed look to the same folder as where the template is saved.
EXAMPLE 7
Get-PnPSiteTemplate -Out template.pnp -Handlers Lists, SiteSecurity
Extracts a provisioning template in Office Open XML from the current web, but only processes lists and site security when generating the template.
EXAMPLE 8
$handler1 = New-PnPExtensibilityHandlerObject -Assembly Contoso.Core.Handlers -Type Contoso.Core.Handlers.MyExtensibilityHandler1
$handler2 = New-PnPExtensibilityHandlerObject -Assembly Contoso.Core.Handlers -Type Contoso.Core.Handlers.MyExtensibilityHandler2
Get-PnPSiteTemplate -Out NewTemplate.xml -ExtensibilityHandlers $handler1,$handler2
This will create two new ExtensibilityHandler objects that are run during extraction of the template
EXAMPLE 9
Only supported on SP2016, SP2019 and SP Online
Get-PnPSiteTemplate -Out template.pnp -PersistMultiLanguageResources
Extracts a provisioning template in Office Open XML from the current web, and for supported artifacts it will create a resource file for each supported language (based upon the language settings of the current web). The generated resource files will be named after the value specified in the Out parameter. For instance if the Out parameter is specified as -Out 'template.xml' the generated resource file will be called 'template.en-US.resx'.
EXAMPLE 10
Only supported on SP2016, SP2019 and SP Online
Get-PnPSiteTemplate -Out template.pnp -PersistMultiLanguageResources -ResourceFilePrefix MyResources
Extracts a provisioning template in Office Open XML from the current web, and for supported artifacts it will create a resource file for each supported language (based upon the language settings of the current web). The generated resource files will be named 'MyResources.en-US.resx' etc.
EXAMPLE 11
$template = Get-PnPSiteTemplate -OutputInstance
Extracts an instance of a provisioning template object from the current web. This syntax cannot be used together with the -Out parameter, but it can be used together with any other supported parameters.
EXAMPLE 12
Get-PnPSiteTemplate -Out template.pnp -ContentTypeGroups "Group A","Group B"
Extracts a provisioning template in Office Open XML from the current web, but only processes content types from the to given content type groups.
EXAMPLE 13
Get-PnPSiteTemplate -Out template.pnp -ExcludeContentTypesFromSyndication
Extracts a provisioning template in Office Open XML from the current web, excluding content types provisioned through content type syndication (content type hub), in order to prevent provisioning errors if the target also provision the content type using syndication.
EXAMPLE 14
Get-PnPSiteTemplate -Out template.pnp -ListsToExtract "Title of List One","95c4efd6-08f4-4c67-94ae-49d696ba1298","Title of List Three"
Extracts a provisioning template in Office Open XML from the current web, including only the lists specified by title or ID.
PARAMETERS
-Configuration
Specify a JSON configuration file to configure the extraction progress.
Type: ExtractConfigurationPipeBind
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Confirm
Prompts you for confirmation before running the cmdlet.
Type: SwitchParameter
Parameter Sets: (All)
Aliases: cf
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Connection
Optional connection to be used by the cmdlet. Retrieve the value for this parameter by either specifying -ReturnConnection on Connect-PnPOnline or by executing Get-PnPConnection.
Type: PnPConnection
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-ContentTypeGroups
Allows you to specify from which content type group(s) the content types should be included into the template.
Type: String[]
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Encoding
The encoding type of the XML file, Unicode is default
Type: Encoding
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-ExcludeContentTypesFromSyndication
Specify whether or not content types issued from a content hub should be exported. By default, these content types are included.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-ExcludeHandlers
Allows you to run all handlers, excluding the ones specified.
Type: Handlers
Parameter Sets: (All)
Aliases:
Accepted values: None, AuditSettings, ComposedLook, CustomActions, ExtensibilityProviders, Features, Fields, Files, Lists, Pages, Publishing, RegionalSettings, SearchSettings, SitePolicy, SupportedUILanguages, TermGroups, Workflows, SiteSecurity, ContentTypes, PropertyBagEntries, PageContents, WebSettings, Navigation, ImageRenditions, ApplicationLifecycleManagement, Tenant, WebApiPermissions, SiteHeader, SiteFooter, Theme, SiteSettings, All
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-ExtensibilityHandlers
Allows you to specify ExtensibilityHandlers to execute while extracting a template.
Type: ExtensibilityHandler[]
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Force
Overwrites the output file if it exists.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Handlers
Allows you to only process a specific type of artifact in the site. Notice that this might result in a non-working template, as some of the handlers require other artifacts in place if they are not part of what your extracting. For possible values for this parameter visit https://docs.microsoft.com/dotnet/api/officedevpnp.core.framework.provisioning.model.handlers
Type: Handlers
Parameter Sets: (All)
Aliases:
Accepted values: None, AuditSettings, ComposedLook, CustomActions, ExtensibilityProviders, Features, Fields, Files, Lists, Pages, Publishing, RegionalSettings, SearchSettings, SitePolicy, SupportedUILanguages, TermGroups, Workflows, SiteSecurity, ContentTypes, PropertyBagEntries, PageContents, WebSettings, Navigation, ImageRenditions, ApplicationLifecycleManagement, Tenant, WebApiPermissions, SiteHeader, SiteFooter, Theme, SiteSettings, All
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-IncludeAllClientSidePages
If specified all client side pages will be included
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-IncludeAllTermGroups
If specified, all term groups will be included. Overrides IncludeSiteCollectionTermGroup.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-IncludeHiddenLists
If specified hidden lists will be included in the template
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-IncludeNativePublishingFiles
If specified, out of the box / native publishing files will be saved.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-IncludeSearchConfiguration
If specified the template will contain the current search configuration of the site.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-IncludeSiteCollectionTermGroup
If specified, all the site collection term groups will be included. Overridden by IncludeAllTermGroups.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-IncludeSiteGroups
If specified all site groups will be included.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-IncludeTermGroupsSecurity
If specified all the managers and contributors of term groups will be included.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-ListsToExtract
Specify the lists to extract, either providing their ID or their Title.
Type: System.Collections.Generic.List`1[System.String]
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-NoBaseTemplate
{{ Fill NoBaseTemplate Description }}
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Out
Filename to write to, optionally including full path
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: 0
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-OutputInstance
Returns the template as an in-memory object, which is an instance of the SiteTemplate type of the PnP Core Component. It cannot be used together with the -Out parameter.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-PersistBrandingFiles
If specified the files used for masterpages, sitelogo, alternate CSS and the files that make up the composed look will be saved.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-PersistMultiLanguageResources
If specified, resource values for applicable artifacts will be persisted to a resource file
Only applicable to: SharePoint Online, SharePoint Server 2019, SharePoint Server 2016
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-PersistPublishingFiles
If specified the files used for the publishing feature will be saved.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-ResourceFilePrefix
If specified, resource files will be saved with the specified prefix instead of using the template name specified. If no template name is specified the files will be called PnP-Resources.<language>.resx. See examples for more info.
Only applicable to: SharePoint Online, SharePoint Server 2019, SharePoint Server 2016
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Schema
The schema of the output to use, defaults to the latest schema
Type: XMLPnPSchemaVersion
Parameter Sets: (All)
Aliases:
Accepted values: LATEST, V201503, V201505, V201508, V201512, V201605, V201705, V201801, V201805, V201807, V201903, V201909, V202002
Required: False
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-SkipVersionCheck
During extraction the version of the server will be checked for certain actions. If you specify this switch, this check will be skipped.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-TemplateDisplayName
It can be used to specify the DisplayName of the template file that will be extracted.
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-TemplateImagePreviewUrl
It can be used to specify the ImagePreviewUrl of the template file that will be extracted.
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-TemplateProperties
It can be used to specify custom Properties for the template file that will be extracted.
Type: Hashtable
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-TemplateProviderExtensions
Allows you to specify ITemplateProviderExtension to execute while extracting a template.
Type: ITemplateProviderExtension[]
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Web
This parameter allows you to optionally apply the cmdlet action to a subweb within the current web. In most situations this parameter is not required and you can connect to the subweb using Connect-PnPOnline instead. Specify the GUID, server relative url (i.e. /sites/team1) or web instance of the web to apply the command to. Omit this parameter to use the current web.
Type: WebPipeBind
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-WhatIf
Shows what would happen if the cmdlet runs. The cmdlet is not run.
Type: SwitchParameter
Parameter Sets: (All)
Aliases: wi
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False