evont-software.com
Microsoft’s Patterns and Practices (PnP) initiative is a set of community-driven guidelines, practices, and libraries that aim to help developers build better solutions on the Microsoft 365 and SharePoint platforms. As part of the PnP initiative, PowerShell commands have been developed to simplify the management and automation of tasks within these ecosystems. This collection of PowerShell cmdlets is known as Microsoft PnP PowerShell. In this article, we’ll explore the documentation resources available for Microsoft PnP PowerShell, providing developers with a valuable guide to mastering this powerful toolset.
Here is a backup of the earlier documentation pertaining to SharePoint 2019. No warranty!
Refered to:
https://www.powershellgallery.com/packages/SharePointPnPPowerShell2019/3.6.1902.2
Functions for Provisioning:
Adds folders to a list in a PnP Provisioning Template
Add-PnPListFoldersToProvisioningTemplate
-Path <String>
-List <ListPipeBind>
[-Recursive [<SwitchParameter>]]
[-IncludeSecurity [<SwitchParameter>]]
[-TemplateProviderExtensions <ITemplateProviderExtension[]>]
[-Web <WebPipeBind>]
[-Connection <PnPConnection>]
Add-PnPListFoldersToProvisioningTemplate
-Path template.pnp -List 'PnPTestList'
Adds top level folders from a list to an existing template and returns an in-memory PnP Site Template
Add-PnPListFoldersToProvisioningTemplate
-Path template.pnp -List 'PnPTestList'
-Recursive
Adds all folders from a list to an existing template and returns an in-memory PnP Site Template
Add-PnPListFoldersToProvisioningTemplate
-Path template.pnp -List 'PnPTestList'
-Recursive -IncludeSecurity
Adds all folders from a list with unique permissions to an in-memory PnP Site Template
A switch to include ObjectSecurity information.
Type
: SwitchParameterParameter Sets
: (All)Required: False
Position: 5
Accept pipeline input: False
The list to query
Type
: ListPipeBindParameter Sets
: (All)Required: True
Position: 2
Accept pipeline input: False
Filename of the .PNP Open XML site template to read from, optionally including full path.
Type
: StringParameter Sets
: (All)Required: True
Position: 0
Accept pipeline input: False
A switch parameter to include all folders in the list, or just top level folders.
Type
: SwitchParameterParameter Sets
: (All)Required: False
Position: 4
Accept pipeline input: False
Allows you to specify ITemplateProviderExtension to execute while loading the template.
Type
: ITemplateProviderExtension[]Parameter Sets
: (All)Required: False
Position: 6
Accept pipeline input: False
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
: PnPConnectionParameter Sets
: (All)Required: False
Position
: NamedAccept pipeline input: False
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
: WebPipeBindParameter Sets
: (All)Required: False
Position
: NamedAccept pipeline input: False
Adds a file to a PnP Provisioning Template
Add-PnPFileToProvisioningTemplate
-Path <String>
-SourceUrl <String>
[-Container <String>]
[-FileLevel <FileLevel>]
[-TemplateProviderExtensions <ITemplateProviderExtension[]>]
[-FileOverwrite [<SwitchParameter>]]
[-Web <WebPipeBind>]
[-Connection <PnPConnection>]
Add-PnPFileToProvisioningTemplate
-Path <String>
-Source <String>
-Folder <String>
[-Container <String>]
[-FileLevel <FileLevel>]
[-TemplateProviderExtensions <ITemplateProviderExtension[]>]
[-FileOverwrite [<SwitchParameter>]]
[-Web <WebPipeBind>]
[-Connection <PnPConnection>]
Add-PnPFileToProvisioningTemplate
-Path template.pnp -Source
$sourceFilePath
-Folder
$targetFolder
Adds a file to a PnP Site Template
Add-PnPFileToProvisioningTemplate
-Path template.xml -Source
$sourceFilePath
-Folder
$targetFolder
Adds a file reference to a PnP Site XML Template
Add-PnPFileToProvisioningTemplate
-Path template.pnp -Source "./myfile.png" -Folder "folderinsite" -FileLevel Published -FileOverwrite:
$false
Adds a file to a PnP Site Template, specifies the level as Published and defines to not overwrite the file if it exists in the site.
Add-PnPFileToProvisioningTemplate
-Path template.pnp -Source
$sourceFilePath
-Folder
$targetFolder
-Container
$container
Adds a file to a PnP Site Template with a custom container for the file
Add-PnPFileToProvisioningTemplate
-Path template.pnp -SourceUrl "Shared%20Documents/ProjectStatus.docs"
Adds a file to a PnP Provisioning Template retrieved from the currently connected site. The url can be server relative or web relative. If specifying a server relative url has to start with the current site url.
The target Container for the file to add to the in-memory template, optional argument.
Type
: StringParameter Sets
: (All)Required: False
Position: 3
Accept pipeline input: False
The level of the files to add. Defaults to Published
Type
: FileLevelParameter Sets
: (All)Required: False
Position: 4
Accept pipeline input: False
Set to overwrite in site, Defaults to true
Type
: SwitchParameterParameter Sets
: (All)Required: False
Position: 5
Accept pipeline input: False
The target Folder for the file to add to the in-memory template.
Type
: StringParameter Sets
: Local FileRequired: True
Position: 2
Accept pipeline input: False
Filename of the .PNP Open XML site template to read from, optionally including full path.
Type
: StringParameter Sets
: (All)Required: True
Position: 0
Accept pipeline input: False
The file to add to the in-memory template, optionally including full path.
Type
: StringParameter Sets
: Local FileRequired: True
Position: 1
Accept pipeline input: False
The file to add to the in-memory template, specifying its url in the current connected Web.
Type
: StringParameter Sets
: Remove FileRequired: True
Position: 1
Accept pipeline input: False
Allows you to specify ITemplateProviderExtension to execute while loading the template.
Type
: ITemplateProviderExtension[]Parameter Sets
: (All)Required: False
Position: 4
Accept pipeline input: False
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
: PnPConnectionParameter Sets
: (All)Required: False
Position
: NamedAccept pipeline input: False
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
: WebPipeBindParameter Sets
: (All)Required: False
Position
: NamedAccept pipeline input: False
Adds datarows to a list inside a PnP Provisioning Template
Add-PnPDataRowsToProvisioningTemplate
-Path <String>
-List <ListPipeBind>
[-Query <String>]
[-Fields <String[]>]
[-TokenizeUrls [<SwitchParameter>]]
[-TemplateProviderExtensions <ITemplateProviderExtension[]>]
[-IncludeSecurity [<SwitchParameter>]]
[-Web <WebPipeBind>]
[-Connection <PnPConnection>]
Add-PnPDataRowsToProvisioningTemplate
-Path template.pnp -List 'PnPTestList' -Query '<View></View>' -Fields 'Title','Choice'
Adds datarows from the provided list to the PnP Provisioning Template at the provided location
Add-PnPDataRowsToProvisioningTemplate
-Path template.pnp -List 'PnPTestList' -Query '<View></View>' -Fields 'Title','Choice'
-IncludeSecurity
Adds datarows from the provided list to the PnP Provisioning Template at the provided location
The fields to retrieve. If not specified all fields will be loaded in the returned list object.
Type
: String[]Parameter Sets
: (All)Required: False
Position
: NamedAccept pipeline input: False
A switch to include ObjectSecurity information.
Type
: SwitchParameterParameter Sets
: (All)Required: False
Position: 5
Accept pipeline input: False
The list to query
Type
: ListPipeBindParameter Sets
: (All)Required: True
Position
: NamedAccept pipeline input: False
Filename of the .PNP Open XML site template to read from, optionally including full path.
Type
: StringParameter Sets
: (All)Required: True
Position: 0
Accept pipeline input: False
The CAML query to execute against the list. Defaults to all items.
Type
: StringParameter Sets
: (All)Required: False
Position
: NamedAccept pipeline input: False
Allows you to specify ITemplateProviderExtension to execute while loading the template.
Type
: ITemplateProviderExtension[]Parameter Sets
: (All)Required: False
Position: 4
Accept pipeline input: False
If set, this switch will try to tokenize the values with web and site related tokens
Type
: SwitchParameterParameter Sets
: (All)Required: False
Position
: NamedAccept pipeline input: False
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
: PnPConnectionParameter Sets
: (All)Required: False
Position
: NamedAccept pipeline input: False
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
: WebPipeBindParameter Sets
: (All)Required: False
Position
: NamedAccept pipeline input: False
Adds a PnP Provisioning Template object to a tenant template
Add-PnPProvisioningTemplate
-SiteTemplate <ProvisioningTemplate>
-TenantTemplate <ProvisioningHierarchy>
Add-PnpProvisioningTemplate
-TenantTemplate
$tenanttemplate
-SiteTemplate
$sitetemplate
Adds an existing site template to an existing tenant template object
The template to add to the tenant template
Type
: ProvisioningTemplateParameter Sets
: (All)Required: True
Position
: NamedAccept pipeline input: False
The tenant template to add the template to
Type
: ProvisioningHierarchyParameter Sets
: (All)Required: True
Position
: NamedAccept pipeline input: True
Applies a site template to a web
Apply-PnPProvisioningTemplate
[-InputInstance <ProvisioningTemplate>]
[-TemplateId <String>]
[-ResourceFolder <String>]
[-OverwriteSystemPropertyBagValues [<SwitchParameter>]]
[-IgnoreDuplicateDataRowErrors [<SwitchParameter>]]
[-ProvisionContentTypesToSubWebs [<SwitchParameter>]]
[-ProvisionFieldsToSubWebs [<SwitchParameter>]]
[-ClearNavigation [<SwitchParameter>]]
[-Parameters <Hashtable>]
[-Handlers <Handlers>]
[-ExcludeHandlers <Handlers>]
[-ExtensibilityHandlers <ExtensibilityHandler[]>]
[-TemplateProviderExtensions <ITemplateProviderExtension[]>]
[-Web <WebPipeBind>]
[-Connection <PnPConnection>]
Apply-PnPProvisioningTemplate
-Path <String>
[-TemplateId <String>]
[-ResourceFolder <String>]
[-OverwriteSystemPropertyBagValues [<SwitchParameter>]]
[-IgnoreDuplicateDataRowErrors [<SwitchParameter>]]
[-ProvisionContentTypesToSubWebs [<SwitchParameter>]]
[-ProvisionFieldsToSubWebs [<SwitchParameter>]]
[-ClearNavigation [<SwitchParameter>]]
[-Parameters <Hashtable>]
[-Handlers <Handlers>]
[-ExcludeHandlers <Handlers>]
[-ExtensibilityHandlers <ExtensibilityHandler[]>]
[-TemplateProviderExtensions <ITemplateProviderExtension[]>]
[-Web <WebPipeBind>]
[-Connection <PnPConnection>]
Apply-PnPProvisioningTemplate
-Path template.xml
Applies a site template in XML format to the current web.
Apply-PnPProvisioningTemplate
-Path template.xml -ResourceFolder c:\provisioning\resources
Applies a site template in XML format to the current web. Any resources like files that are referenced in the template will be retrieved from the folder as specified with the ResourceFolder parameter.
Apply-PnPProvisioningTemplate
-Path template.xml -Parameters @{"ListTitle"="Projects";"parameter2"="a second value"
}
Applies a site template in XML format to the current web. It will populate the parameter in the template the values as specified and in the template you can refer to those values with the {parameter:} token.
For instance with the example above, specifying {parameter:ListTitle} in your template will translate to ‘Projects’ when applying the template. These tokens can be used in most string values in a template.
Apply-PnPProvisioningTemplate
-Path template.xml -Handlers Lists, SiteSecurity
Applies a site template in XML format to the current web. It will only apply the lists and site security part of the template.
Apply-PnPProvisioningTemplate
-Path template.pnp
Applies a site template from a pnp package to the current web.
Apply-PnPProvisioningTemplate
-Path https://tenant.sharepoint.com/sites/templatestorage/Documents/template.pnp
Applies a site template from a pnp package stored in a library to the current web.
$handler1
=
New-PnPExtensibilityHandlerObject
-Assembly Contoso.Core.Handlers -Type Contoso.Core.Handlers.MyExtensibilityHandler1$handler2
=
New-PnPExtensibilityHandlerObject
-Assembly Contoso.Core.Handlers -Type Contoso.Core.Handlers.MyExtensibilityHandler2Apply-PnPProvisioningTemplate
-Path NewTemplate.xml -ExtensibilityHandlers
$handler1
,
$handler2
This will create two new ExtensibilityHandler objects that are run while provisioning the template
Apply-PnPProvisioningTemplate
-Path .\ -InputInstance
$template
Applies a site template from an in-memory instance of a ProvisioningTemplate type of the PnP Core Component, reading the supporting files, if any, from the current (.) path. The syntax can be used together with any other supported parameters.
Apply-PnPProvisioningTemplate
-Path .\template.xml -TemplateId "MyTemplate"
Applies the ProvisioningTemplate with the ID “MyTemplate” located in the template definition file template.xml.
Override the RemoveExistingNodes attribute in the Navigation elements of the template. If you specify this value the navigation nodes will always be removed before adding the nodes in the template
Type
: SwitchParameterParameter Sets
: (All)Required: False
Position
: NamedAccept pipeline input: False
Allows you to run all handlers, excluding the ones specified.
Type
: HandlersParameter Sets
: __AllParameterSetsRequired: False
Position
: NamedAccept pipeline input: False
Allows you to specify ExtensbilityHandlers to execute while applying a template
Type
: ExtensibilityHandler[]Parameter Sets
: __AllParameterSetsRequired: False
Position
: NamedAccept pipeline input: False
Allows you to only process a specific part of the template. Notice that this might fail, as some of the handlers require other artifacts in place if they are not part of what your applying. Visit https://docs.microsoft.com/dotnet/api/officedevpnp.core.framework.provisioning.model.handlers for possible values.
Type
: HandlersParameter Sets
: __AllParameterSetsRequired: False
Position
: NamedAccept pipeline input: False
Ignore duplicate data row errors when the data row in the template already exists.
Type
: SwitchParameterParameter Sets
: __AllParameterSetsRequired: False
Position
: NamedAccept pipeline input: False
Allows you to provide an in-memory instance of the ProvisioningTemplate type of the PnP Core Component. When using this parameter, the -Path parameter refers to the path of any supporting file for the template.
Type
: ProvisioningTemplateParameter Sets
: InstanceRequired: False
Position
: NamedAccept pipeline input: False
Specify this parameter if you want to overwrite and/or create properties that are known to be system entries (starting with vti_, dlc_, etc.)
Type
: SwitchParameterParameter Sets
: __AllParameterSetsRequired: False
Position
: NamedAccept pipeline input: False
Allows you to specify parameters that can be referred to in the template by means of the {parameter:<Key>} token. See examples on how to use this parameter.
Type
: HashtableParameter Sets
: __AllParameterSetsRequired: False
Position
: NamedAccept pipeline input: False
Path to the xml or pnp file containing the provisioning template.
Type
: StringParameter Sets
: PathRequired: True
Position: 0
Accept pipeline input: True
If set content types will be provisioned if the target web is a subweb.
Type
: SwitchParameterParameter Sets
: (All)Required: False
Position
: NamedAccept pipeline input: False
If set fields will be provisioned if the target web is a subweb.
Type
: SwitchParameterParameter Sets
: (All)Required: False
Position
: NamedAccept pipeline input: False
Root folder where resources/files that are being referenced in the template are located. If not specified the same folder as where the provisioning template is located will be used.
Type
: StringParameter Sets
: __AllParameterSetsRequired: False
Position
: NamedAccept pipeline input: False
ID of the template to use from the xml file containing the provisioning template. If not specified and multiple ProvisioningTemplate elements exist, the last one will be used.
Type
: StringParameter Sets
: __AllParameterSetsRequired: False
Position
: NamedAccept pipeline input: False
Allows you to specify ITemplateProviderExtension to execute while applying a template.
Type
: ITemplateProviderExtension[]Parameter Sets
: __AllParameterSetsRequired: False
Position
: NamedAccept pipeline input: False
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
: PnPConnectionParameter Sets
: (All)Required: False
Position
: NamedAccept pipeline input: False
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
: WebPipeBindParameter Sets
: (All)Required: False
Position
: NamedAccept pipeline input: False
Creates a pnp package file of an existing template xml, and includes all files in the current folder
Convert-PnPFolderToProvisioningTemplate
-Out <String>
[-Force [<SwitchParameter>]]
[-Folder <String>]
Convert-PnPFolderToProvisioningTemplate
-Out template.pnp
Creates a pnp package file of an existing template xml, and includes all files in the current folder
Convert-PnPFolderToProvisioningTemplate
-Out template.pnp -Folder c:\temp
Creates a pnp package file of an existing template xml, and includes all files in the c:\temp folder
Folder to process. If not specified the current folder will be used.
Type
: StringParameter Sets
: (All)Required: False
Position: 1
Accept pipeline input: False
Overwrites the output file if it exists.
Type
: SwitchParameterParameter Sets
: (All)Required: False
Position
: NamedAccept pipeline input: False
Filename to write to, optionally including full path.
Type
: StringParameter Sets
: (All)Required: True
Position: 0
Accept pipeline input: False
Converts a provisioning template to an other schema version
Convert-PnPProvisioningTemplate
-Path <String>
[-Out <String>]
[-Encoding <Encoding>]
[-Force [<SwitchParameter>]]
[-ToSchema <XMLPnPSchemaVersion>]
Convert-PnPProvisioningTemplate
-Path template.xml
Converts a provisioning template to the latest schema and outputs the result to current console.
Convert-PnPProvisioningTemplate
-Path template.xml -Out newtemplate.xml
Converts a provisioning template to the latest schema and outputs the result the newtemplate.xml file.
Convert-PnPProvisioningTemplate
-Path template.xml -Out newtemplate.xml -ToSchema V201512
Converts a provisioning template to the latest schema using the 201512 schema and outputs the result the newtemplate.xml file.
The encoding type of the XML file, Unicode is default
Type
: EncodingParameter Sets
: (All)Required: False
Position
: NamedAccept pipeline input: False
Overwrites the output file if it exists
Type
: SwitchParameterParameter Sets
: (All)Required: False
Position
: NamedAccept pipeline input: False
Filename to write to, optionally including full path
Type
: StringParameter Sets
: (All)Required: False
Position
: NamedAccept pipeline input: False
Path to the xml file containing the site template
Type
: StringParameter Sets
: (All)Required: True
Position: 0
Accept pipeline input: True
The schema of the output to use, defaults to the latest schema
Type
: XMLPnPSchemaVersionParameter Sets
: (All)Required: False
Position: 1
Accept pipeline input: False
Exports one or more lists to provisioning template
Export-PnPListToProvisioningTemplate
-List <String>
[-Out <String>]
[-Force [<SwitchParameter>]]
[-OutputInstance [<SwitchParameter>]]
[-Schema <XMLPnPSchemaVersion>]
[-Web <WebPipeBind>]
[-Connection <PnPConnection>]
Export-PnPListToProvisioningTemplate
-Out template.xml -List "Documents"
Extracts a list to a new provisioning template including the list specified by title or ID.
Export-PnPListToProvisioningTemplate
-Out template.pnp -List "Documents","Events"
Extracts a list to a new provisioning template Office Open XML file, including the lists specified by title or ID.
Overwrites the output file if it exists.
Type
: SwitchParameterParameter Sets
: (All)Required: False
Position
: NamedAccept pipeline input: False
Specify the lists to extract, either providing their ID or their Title.
Type
: StringParameter Sets
: (All)Required: True
Position
: NamedAccept pipeline input: False
Filename to write to, optionally including full path
Type
: StringParameter Sets
: (All)Required: False
Position: 0
Accept pipeline input: False
Returns the template as an in-memory object, which is an instance of the ProvisioningTemplate type of the PnP Core Component. It cannot be used together with the -Out parameter.
Type
: SwitchParameterParameter Sets
: (All)Required: False
Position
: NamedAccept pipeline input: False
The schema of the output to use, defaults to the latest schema
Type
: XMLPnPSchemaVersionParameter Sets
: (All)Required: False
Position: 1
Accept pipeline input: False
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
: PnPConnectionParameter Sets
: (All)Required: False
Position
: NamedAccept pipeline input: False
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
: WebPipeBindParameter Sets
: (All)Required: False
Position
: NamedAccept pipeline input: False
Generates a provisioning site template from a web
Get-PnPProvisioningTemplate
[-Out <String>]
[-IncludeAllTermGroups [<SwitchParameter>]]
[-IncludeSiteCollectionTermGroup [<SwitchParameter>]]
[-IncludeSiteGroups [<SwitchParameter>]]
[-IncludeTermGroupsSecurity [<SwitchParameter>]]
[-IncludeSearchConfiguration [<SwitchParameter>]]
[-PersistBrandingFiles [<SwitchParameter>]]
[-PersistPublishingFiles [<SwitchParameter>]]
[-IncludeNativePublishingFiles [<SwitchParameter>]]
[-IncludeHiddenLists [<SwitchParameter>]]
[-IncludeAllClientSidePages [<SwitchParameter>]]
[-SkipVersionCheck [<SwitchParameter>]]
[-PersistMultiLanguageResources [<SwitchParameter>]]
[-ResourceFilePrefix <String>]
[-Handlers <Handlers>]
[-ExcludeHandlers <Handlers>]
[-ExtensibilityHandlers <ExtensibilityHandler[]>]
[-TemplateProviderExtensions <ITemplateProviderExtension[]>]
[-ContentTypeGroups <String[]>]
[-Force [<SwitchParameter>]]
[-Encoding <Encoding>]
[-TemplateDisplayName <String>]
[-TemplateImagePreviewUrl <String>]
[-TemplateProperties <Hashtable>]
[-OutputInstance [<SwitchParameter>]]
[-ExcludeContentTypesFromSyndication [<SwitchParameter>]]
[-ListsToExtract <String>]
[-Configuration <ExtractConfigurationPipeBind>]
[-Schema <XMLPnPSchemaVersion>]
[-Web <WebPipeBind>]
[-Connection <PnPConnection>]
Get-PnPProvisioningTemplate
-Out template.pnp
Extracts a provisioning template in Office Open XML from the current web.
Get-PnPProvisioningTemplate
-Out template.xml
Extracts a provisioning template in XML format from the current web.
Get-PnPProvisioningTemplate
-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.
Get-PnPProvisioningTemplate
-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.
Get-PnPProvisioningTemplate
-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.
Get-PnPProvisioningTemplate
-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.
Get-PnPProvisioningTemplate
-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.
$handler1
=
New-PnPExtensibilityHandlerObject
-Assembly Contoso.Core.Handlers -Type Contoso.Core.Handlers.MyExtensibilityHandler1$handler2
=
New-PnPExtensibilityHandlerObject
-Assembly Contoso.Core.Handlers -Type Contoso.Core.Handlers.MyExtensibilityHandler2Get-PnPProvisioningTemplate
-Out NewTemplate.xml -ExtensibilityHandlers
$handler1
,
$handler2
This will create two new ExtensibilityHandler objects that are run during extraction of the template
Only supported on SP2016, SP2019 and SP Online
Get-PnPProvisioningTemplate
-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’.
Only supported on SP2016, SP2019 and SP Online
Get-PnPProvisioningTemplate
-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.
$template
=
Get-PnPProvisioningTemplate
-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.
Get-PnPProvisioningTemplate
-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.
Get-PnPProvisioningTemplate
-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.
Get-PnPProvisioningTemplate
-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.
Specify a JSON configuration file to configure the extraction progress.
Type
: ExtractConfigurationPipeBindParameter Sets
: (All)Required: False
Position
: NamedAccept pipeline input: False
Allows you to specify from which content type group(s) the content types should be included into the template.
Type
: String[]Parameter Sets
: (All)Required: False
Position
: NamedAccept pipeline input: False
The encoding type of the XML file, Unicode is default
Type
: EncodingParameter Sets
: (All)Required: False
Position
: NamedAccept pipeline input: False
Specify whether or not content types issued from a content hub should be exported. By default, these content types are included.
Type
: SwitchParameterParameter Sets
: (All)Required: False
Position
: NamedAccept pipeline input: False
Allows you to run all handlers, excluding the ones specified.
Type
: HandlersParameter Sets
: (All)Required: False
Position
: NamedAccept pipeline input: False
Allows you to specify ExtensibilityHandlers to execute while extracting a template.
Type
: ExtensibilityHandler[]Parameter Sets
: (All)Required: False
Position
: NamedAccept pipeline input: False
Overwrites the output file if it exists.
Type
: SwitchParameterParameter Sets
: (All)Required: False
Position
: NamedAccept pipeline input: False
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
: HandlersParameter Sets
: (All)Required: False
Position
: NamedAccept pipeline input: False
If specified all client side pages will be included
Type
: SwitchParameterParameter Sets
: (All)Required: False
Position
: NamedAccept pipeline input: False
If specified, all term groups will be included. Overrides IncludeSiteCollectionTermGroup.
Type
: SwitchParameterParameter Sets
: (All)Required: False
Position
: NamedAccept pipeline input: False
If specified hidden lists will be included in the template
Type
: SwitchParameterParameter Sets
: (All)Required: False
Position
: NamedAccept pipeline input: False
If specified, out of the box / native publishing files will be saved.
Type
: SwitchParameterParameter Sets
: (All)Required: False
Position
: NamedAccept pipeline input: False
If specified the template will contain the current search configuration of the site.
Type
: SwitchParameterParameter Sets
: (All)Required: False
Position
: NamedAccept pipeline input: False
If specified, all the site collection term groups will be included. Overridden by IncludeAllTermGroups.
Type
: SwitchParameterParameter Sets
: (All)Required: False
Position
: NamedAccept pipeline input: False
If specified all site groups will be included.
Type
: SwitchParameterParameter Sets
: (All)Required: False
Position
: NamedAccept pipeline input: False
If specified all the managers and contributors of term groups will be included.
Type
: SwitchParameterParameter Sets
: (All)Required: False
Position
: NamedAccept pipeline input: False
Specify the lists to extract, either providing their ID or their Title.
Type
: StringParameter Sets
: (All)Required: False
Position
: NamedAccept pipeline input: False
Filename to write to, optionally including full path
Type
: StringParameter Sets
: (All)Required: False
Position: 0
Accept pipeline input: False
Returns the template as an in-memory object, which is an instance of the ProvisioningTemplate type of the PnP Core Component. It cannot be used together with the -Out parameter.
Type
: SwitchParameterParameter Sets
: (All)Required: False
Position
: NamedAccept pipeline input: False
If specified the files used for masterpages, sitelogo, alternate CSS and the files that make up the composed look will be saved.
Type
: SwitchParameterParameter Sets
: (All)Required: False
Position
: NamedAccept pipeline input: False
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
: SwitchParameterParameter Sets
: (All)Required: False
Position
: NamedAccept pipeline input: False
If specified the files used for the publishing feature will be saved.
Type
: SwitchParameterParameter Sets
: (All)Required: False
Position
: NamedAccept pipeline input: False
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
: StringParameter Sets
: (All)Required: False
Position
: NamedAccept pipeline input: False
The schema of the output to use, defaults to the latest schema
Type
: XMLPnPSchemaVersionParameter Sets
: (All)Required: False
Position: 1
Accept pipeline input: False
During extraction the version of the server will be checked for certain actions. If you specify this switch, this check will be skipped.
Type
: SwitchParameterParameter Sets
: (All)Required: False
Position
: NamedAccept pipeline input: False
It can be used to specify the DisplayName of the template file that will be extracted.
Type
: StringParameter Sets
: (All)Required: False
Position
: NamedAccept pipeline input: False
It can be used to specify the ImagePreviewUrl of the template file that will be extracted.
Type
: StringParameter Sets
: (All)Required: False
Position
: NamedAccept pipeline input: False
It can be used to specify custom Properties for the template file that will be extracted.
Type
: HashtableParameter Sets
: (All)Required: False
Position
: NamedAccept pipeline input: False
Allows you to specify ITemplateProviderExtension to execute while extracting a template.
Type
: ITemplateProviderExtension[]Parameter Sets
: (All)Required: False
Position
: NamedAccept pipeline input: False
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
: PnPConnectionParameter Sets
: (All)Required: False
Position
: NamedAccept pipeline input: False
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
: WebPipeBindParameter Sets
: (All)Required: False
Position
: NamedAccept pipeline input: False
Retrieves or searches provisioning templates from the PnP Template Gallery
Get-PnPProvisioningTemplateFromGallery
[-Identity <Guid>]
[-Path <String>]
[-Force [<SwitchParameter>]]
Get-PnPProvisioningTemplateFromGallery
[-Search <String>]
[-TargetPlatform <TargetPlatform>]
[-TargetScope <TargetScope>]
Get-PnPProvisioningTemplateFromGallery
Retrieves all templates from the gallery
Get-PnPProvisioningTemplateFromGallery
-Search "Data"
Searches for a templates containing the word ‘Data’ in the Display Name
Get-PnPProvisioningTemplateFromGallery
-Identity ae925674-8aa6-438b-acd0-d2699a022edd
Retrieves a template with the specified ID
$template
=
Get-PnPProvisioningTemplateFromGallery
-Identity ae925674-8aa6-438b-acd0-d2699a022eddApply-PnPProvisioningTemplate
-InputInstance
$template
Retrieves a template with the specified ID and applies it to the site.
$template
=
Get-PnPProvisioningTemplateFromGallery
-Identity ae925674-8aa6-438b-acd0-d2699a022edd -Path c:\temp
Retrieves a template with the specified ID and saves the template to the specified path
Type
: SwitchParameterParameter Sets
: IdentityRequired: False
Position
: NamedAccept pipeline input: False
Type
: GuidParameter Sets
: IdentityRequired: False
Position
: NamedAccept pipeline input: False
Type
: StringParameter Sets
: IdentityRequired: False
Position
: NamedAccept pipeline input: False
Type
: StringParameter Sets
: SearchRequired: False
Position
: NamedAccept pipeline input: False
Type
: TargetPlatformParameter Sets
: SearchRequired: False
Position
: NamedAccept pipeline input: False
Type
: TargetScopeParameter Sets
: SearchRequired: False
Position
: NamedAccept pipeline input: False
Creates a new provisioning template object
$template
=
New-PnPProvisioningTemplate
Creates a new instance of a site template object.
Generates a provisioning template from a given folder, including only files that are present in that folder
New-PnPProvisioningTemplateFromFolder
[-Out <String>]
[-Folder <String>] [-Match
<String>]
[-ContentType <ContentTypePipeBind>]
[-Properties <Hashtable>]
[-AsIncludeFile [<SwitchParameter>]]
[-Force [<SwitchParameter>]]
[-Encoding <Encoding>]
[-TargetFolder <String>]
[-Schema <XMLPnPSchemaVersion>]
[-Web <WebPipeBind>]
[-Connection <PnPConnection>]
New-PnPProvisioningTemplateFromFolder
-Out template.xml
Creates an empty provisioning template, and includes all files in the current folder.
New-PnPProvisioningTemplateFromFolder
-Out template.xml -Folder c:\temp
Creates an empty provisioning template, and includes all files in the c:\temp folder.
New-PnPProvisioningTemplateFromFolder
-Out template.xml -Folder c:\temp -Match
*.js
Creates an empty provisioning template, and includes all files with a JS extension in the c:\temp folder.
New-PnPProvisioningTemplateFromFolder
-Out template.xml -Folder c:\temp -Match *.js -TargetFolder "Shared Documents"
Creates an empty provisioning template, and includes all files with a JS extension in the c:\temp folder and marks the files in the template to be added to the ‘Shared Documents’ folder
New-PnPProvisioningTemplateFromFolder
-Out template.xml -Folder c:\temp -Match *.js -TargetFolder "Shared Documents" -ContentType "Test Content Type"
Creates an empty provisioning template, and includes all files with a JS extension in the c:\temp folder and marks the files in the template to be added to the ‘Shared Documents’ folder. It will add a property to the item for the content type.
New-PnPProvisioningTemplateFromFolder
-Out template.xml -Folder c:\temp -Match *.js -TargetFolder "Shared Documents" -Properties @{"Title" = "Test Title"; "Category"="Test Category"
}
Creates an empty provisioning template, and includes all files with a JS extension in the c:\temp folder and marks the files in the template to be added to the ‘Shared Documents’ folder. It will add the specified properties to the file entries.
New-PnPProvisioningTemplateFromFolder
-Out template.pnp
Creates an empty provisioning template as a pnp package file, and includes all files in the current folder
New-PnPProvisioningTemplateFromFolder
-Out template.pnp -Folder c:\temp
Creates an empty provisioning template as a pnp package file, and includes all files in the c:\temp folder
If specified, the output will only contain the <pnp:Files> element. This allows the output to be included in another template.
Type
: SwitchParameterParameter Sets
: (All)Required: False
Position
: NamedAccept pipeline input: False
An optional content type to use.
Type
: ContentTypePipeBindParameter Sets
: (All)Required: False
Position
: NamedAccept pipeline input: False
The encoding type of the XML file, Unicode is default
Type
: EncodingParameter Sets
: (All)Required: False
Position
: NamedAccept pipeline input: False
Folder to process. If not specified the current folder will be used.
Type
: StringParameter Sets
: (All)Required: False
Position: 0
Accept pipeline input: False
Overwrites the output file if it exists.
Type
: SwitchParameterParameter Sets
: (All)Required: False
Position
: NamedAccept pipeline input: False
Optional wildcard pattern to match filenames against. If empty all files will be included.
Type
: StringParameter Sets
: (All)Required: False
Position
: NamedAccept pipeline input: False
Filename to write to, optionally including full path.
Type
: StringParameter Sets
: (All)Required: False
Position: 0
Accept pipeline input: False
Additional properties to set for every file entry in the generated template.
Type
: HashtableParameter Sets
: (All)Required: False
Position
: NamedAccept pipeline input: False
The schema of the output to use, defaults to the latest schema
Type
: XMLPnPSchemaVersionParameter Sets
: (All)Required: False
Position: 1
Accept pipeline input: False
Target folder to provision to files to. If not specified, the current folder name will be used.
Type
: StringParameter Sets
: (All)Required: False
Position: 1
Accept pipeline input: False
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
: PnPConnectionParameter Sets
: (All)Required: False
Position
: NamedAccept pipeline input: False
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
: WebPipeBindParameter Sets
: (All)Required: False
Position
: NamedAccept pipeline input: False
Loads/Reads a PnP file from the file system or a string
Read-PnPProvisioningTemplate
-Path <String>
[-TemplateProviderExtensions <ITemplateProviderExtension[]>]
Read-PnPProvisioningTemplate
-Xml <String>
[-TemplateProviderExtensions <ITemplateProviderExtension[]>]
Read-PnPProvisioningTemplate
-Path template.pnp
Loads a PnP file from the file system
Read-PnPProvisioningTemplate
-Path template.pnp -TemplateProviderExtensions
$extensions
Loads a PnP file from the file system using some custom template provider extensions while loading the file.
Read-PnPProvisioningTemplate
-Xml
$xml
Reads a PnP Provisioning template from a string containing the XML of a provisioning template
Filename to read from, optionally including full path.
Type
: StringParameter Sets
: By PathRequired: True
Position: 0
Accept pipeline input: False
Allows you to specify ITemplateProviderExtension to execute while loading the template.
Type
: ITemplateProviderExtension[]Parameter Sets
: __AllParameterSetsRequired: False
Position
: NamedAccept pipeline input: False
Variable to read from, containing the valid XML of a provisioning template.
Type
: StringParameter Sets
: By XMLRequired: True
Position: 1
Accept pipeline input: False
Removes a file from a PnP Provisioning Template
Remove-PnPFileFromProvisioningTemplate
-Path <String>
-FilePath <String>
[-TemplateProviderExtensions <ITemplateProviderExtension[]>]
Remove-PnPFileFromProvisioningTemplate
-Path template.pnp -FilePath filePath
Removes a file from an in-memory PnP Provisioning Template
The relative File Path of the file to remove from the in-memory template
Type
: StringParameter Sets
: (All)Required: True
Position: 1
Accept pipeline input: False
Filename to read the template from, optionally including full path.
Type
: StringParameter Sets
: (All)Required: True
Position: 0
Accept pipeline input: False
Allows you to specify ITemplateProviderExtension to execute while saving the template.
Type
: ITemplateProviderExtension[]Parameter Sets
: (All)Required: False
Position: 2
Accept pipeline input: False
Saves a PnP site template to the file system
Save-PnPProvisioningTemplate
-Template <ProvisioningTemplatePipeBind>
-Out <String>
[-Schema <XMLPnPSchemaVersion>]
[-Force [<SwitchParameter>]]
[-TemplateProviderExtensions <ITemplateProviderExtension[]>]
Save-PnPProvisioningTemplate
-Template .\template.xml -Out .\template.pnp
Saves a PnP provisioning template to the file system as a PnP file.
$template
=
Read-PnPProvisioningTemplate
-Path template.xmlSave-PnPProvisioningTemplate
-Template
$template
-Out .\template.pnp
Saves a PnP site template to the file system as a PnP file. The schema used will the latest released schema when creating the PnP file regardless of the original schema
$template
=
Read-PnPProvisioningTemplate
-Path template.xmlSave-PnPProvisioningTemplate
-Template
$template
-Out .\template.pnp -Schema V202002
Saves a PnP site template to the file system as a PnP file and converts the template in the PnP file to the specified schema.
Read-PnPProvisioningTemplate
-Path template.xml |
Save-PnPProvisioningTemplate
-Out .\template.pnp
Saves a PnP site template to the file system as a PnP file.
Specifying the Force parameter will skip the confirmation question.
Type
: SwitchParameterParameter Sets
: (All)Required: False
Position
: NamedAccept pipeline input: False
Filename to write to, optionally including full path.
Type
: StringParameter Sets
: (All)Required: True
Position: 0
Accept pipeline input: False
The optional schema to use when creating the PnP file. Always defaults to the latest schema.
Type
: XMLPnPSchemaVersionParameter Sets
: (All)Required: False
Position
: NamedAccept pipeline input: False
Allows you to provide an in-memory instance of the ProvisioningTemplate type of the PnP Core Component. When using this parameter, the -Out parameter refers to the path for saving the template and storing any supporting file for the template.
Type
: ProvisioningTemplatePipeBindParameter Sets
: (All)Aliases
: InputInstanceRequired: True
Position
: NamedAccept pipeline input: True
Allows you to specify the ITemplateProviderExtension to execute while saving a template.
Type
: ITemplateProviderExtension[]Parameter Sets
: (All)Required: False
Position
: NamedAccept pipeline input: False
Sets metadata of a provisioning template
Set-PnPProvisioningTemplateMetadata
-Path <String>
[-TemplateDisplayName <String>]
[-TemplateImagePreviewUrl <String>]
[-TemplateProperties <Hashtable>]
[-TemplateProviderExtensions <ITemplateProviderExtension[]>]
[-Web <WebPipeBind>]
[-Connection <PnPConnection>]
Set-PnPProvisioningTemplateMetadata
-Path template.xml -TemplateDisplayName "DisplayNameValue"
Sets the DisplayName property of a site template in XML format.
Set-PnPProvisioningTemplateMetadata
-Path template.pnp -TemplateDisplayName "DisplayNameValue"
Sets the DisplayName property of a site template in Office Open XML format.
Set-PnPProvisioningTemplateMetadata
-Path template.xml -TemplateImagePreviewUrl "Full URL of the Image Preview"
Sets the Url to the preview image of a site template in XML format.
Set-PnPProvisioningTemplateMetadata
-Path template.pnp -TemplateImagePreviewUrl "Full URL of the Image Preview"
Sets the to the preview image of a site template in Office Open XML format.
Set-PnPProvisioningTemplateMetadata
-Path template.xml -TemplateProperties @{"Property1" = "Test Value 1"; "Property2"="Test Value 2"
}
Sets the property ‘Property1’ to the value ‘Test Value 1’ of a site template in XML format.
Set-PnPProvisioningTemplateMetadata
-Path template.pnp -TemplateProperties @{"Property1" = "Test Value 1"; "Property2"="Test Value 2"
}
Sets the property ‘Property1’ to the value ‘Test Value 1’ of a site template in Office Open XML format.
Path to the xml or pnp file containing the site template.
Type
: StringParameter Sets
: (All)Required: True
Position: 0
Accept pipeline input: True
It can be used to specify the DisplayName of the template file that will be updated.
Type
: StringParameter Sets
: (All)Required: False
Position
: NamedAccept pipeline input: False
It can be used to specify the ImagePreviewUrl of the template file that will be updated.
Type
: StringParameter Sets
: (All)Required: False
Position
: NamedAccept pipeline input: False
It can be used to specify custom Properties for the template file that will be updated.
Type
: HashtableParameter Sets
: (All)Required: False
Position
: NamedAccept pipeline input: False
Allows you to specify ITemplateProviderExtension to execute while extracting a template.
Type
: ITemplateProviderExtension[]Parameter Sets
: (All)Required: False
Position
: NamedAccept pipeline input: False
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
: PnPConnectionParameter Sets
: (All)Required: False
Position
: NamedAccept pipeline input: False
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
: WebPipeBindParameter Sets
: (All)Required: False
Position
: NamedAccept pipeline input: False