evont-software.com

Email: info@evont-software.com

PnP Powershell 2019 Documentation

Category:Administration
Date:
Author: Mathias Osterkamp

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:

Add-PnPListFoldersToProvisioningTemplate

SYNOPSIS

Adds folders to a list in a PnP Provisioning Template

SYNTAX

Add-PnPListFoldersToProvisioningTemplate -Path <String>
-List <ListPipeBind>
[-Recursive [<SwitchParameter>]]
[-IncludeSecurity [<SwitchParameter>]]
[-TemplateProviderExtensions <ITemplateProviderExtension[]>]
[-Web <WebPipeBind>]
[-Connection <PnPConnection>]

EXAMPLES

——————EXAMPLE 1——————

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

——————EXAMPLE 2——————

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

——————EXAMPLE 3——————

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

PARAMETERS

-IncludeSecurity

A switch to include ObjectSecurity information.

Type: SwitchParameter
Parameter Sets: (All)

Required: False
Position: 5
Accept pipeline input: False

-List

The list to query

Type: ListPipeBind
Parameter Sets: (All)

Required: True
Position: 2
Accept pipeline input: False

-Path

Filename of the .PNP Open XML site template to read from, optionally including full path.

Type: String
Parameter Sets: (All)

Required: True
Position: 0
Accept pipeline input: False

-Recursive

A switch parameter to include all folders in the list, or just top level folders.

Type: SwitchParameter
Parameter Sets: (All)

Required: False
Position: 4
Accept pipeline input: False

-TemplateProviderExtensions

Allows you to specify ITemplateProviderExtension to execute while loading the template.

Type: ITemplateProviderExtension[]
Parameter Sets: (All)

Required: False
Position: 6
Accept pipeline input: 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)

Required: False
Position: Named
Accept pipeline input: 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)

Required: False
Position: Named
Accept pipeline input: False


Add-PnPFileToProvisioningTemplate

SYNOPSIS

Adds a file to a PnP Provisioning Template

SYNTAX

Remove File

Add-PnPFileToProvisioningTemplate -Path <String>
-SourceUrl <String>
[-Container <String>]
[-FileLevel <FileLevel>]
[-TemplateProviderExtensions <ITemplateProviderExtension[]>]
[-FileOverwrite [<SwitchParameter>]]
[-Web <WebPipeBind>]
[-Connection <PnPConnection>]

Local File

Add-PnPFileToProvisioningTemplate -Path <String>
-Source <String>
-Folder <String>
[-Container <String>]
[-FileLevel <FileLevel>]
[-TemplateProviderExtensions <ITemplateProviderExtension[]>]
[-FileOverwrite [<SwitchParameter>]]
[-Web <WebPipeBind>]
[-Connection <PnPConnection>]

EXAMPLES

——————EXAMPLE 1——————

Add-PnPFileToProvisioningTemplate -Path template.pnp -Source $sourceFilePath -Folder $targetFolder

Adds a file to a PnP Site Template

——————EXAMPLE 2——————

Add-PnPFileToProvisioningTemplate -Path template.xml -Source $sourceFilePath -Folder $targetFolder

Adds a file reference to a PnP Site XML Template

——————EXAMPLE 3——————

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.

——————EXAMPLE 4——————

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

——————EXAMPLE 5——————

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.

PARAMETERS

-Container

The target Container for the file to add to the in-memory template, optional argument.

Type: String
Parameter Sets: (All)

Required: False
Position: 3
Accept pipeline input: False

-FileLevel

The level of the files to add. Defaults to Published

Type: FileLevel
Parameter Sets: (All)

Required: False
Position: 4
Accept pipeline input: False

-FileOverwrite

Set to overwrite in site, Defaults to true

Type: SwitchParameter
Parameter Sets: (All)

Required: False
Position: 5
Accept pipeline input: False

-Folder

The target Folder for the file to add to the in-memory template.

Type: String
Parameter Sets: Local File

Required: True
Position: 2
Accept pipeline input: False

-Path

Filename of the .PNP Open XML site template to read from, optionally including full path.

Type: String
Parameter Sets: (All)

Required: True
Position: 0
Accept pipeline input: False

-Source

The file to add to the in-memory template, optionally including full path.

Type: String
Parameter Sets: Local File

Required: True
Position: 1
Accept pipeline input: False

-SourceUrl

The file to add to the in-memory template, specifying its url in the current connected Web.

Type: String
Parameter Sets: Remove File

Required: True
Position: 1
Accept pipeline input: False

-TemplateProviderExtensions

Allows you to specify ITemplateProviderExtension to execute while loading the template.

Type: ITemplateProviderExtension[]
Parameter Sets: (All)

Required: False
Position: 4
Accept pipeline input: 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)

Required: False
Position: Named
Accept pipeline input: 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)

Required: False
Position: Named
Accept pipeline input: False


Add-PnPDataRowsToProvisioningTemplate

SYNOPSIS

Adds datarows to a list inside a PnP Provisioning Template

SYNTAX

Add-PnPDataRowsToProvisioningTemplate -Path <String>
-List <ListPipeBind>
[-Query <String>]
[-Fields <String[]>]
[-TokenizeUrls [<SwitchParameter>]]
[-TemplateProviderExtensions <ITemplateProviderExtension[]>]
[-IncludeSecurity [<SwitchParameter>]]
[-Web <WebPipeBind>]
[-Connection <PnPConnection>]

EXAMPLES

——————EXAMPLE 1——————

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

——————EXAMPLE 2——————

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

PARAMETERS

-Fields

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: Named
Accept pipeline input: False

-IncludeSecurity

A switch to include ObjectSecurity information.

Type: SwitchParameter
Parameter Sets: (All)

Required: False
Position: 5
Accept pipeline input: False

-List

The list to query

Type: ListPipeBind
Parameter Sets: (All)

Required: True
Position: Named
Accept pipeline input: False

-Path

Filename of the .PNP Open XML site template to read from, optionally including full path.

Type: String
Parameter Sets: (All)

Required: True
Position: 0
Accept pipeline input: False

-Query

The CAML query to execute against the list. Defaults to all items.

Type: String
Parameter Sets: (All)

Required: False
Position: Named
Accept pipeline input: False

-TemplateProviderExtensions

Allows you to specify ITemplateProviderExtension to execute while loading the template.

Type: ITemplateProviderExtension[]
Parameter Sets: (All)

Required: False
Position: 4
Accept pipeline input: False

-TokenizeUrls

If set, this switch will try to tokenize the values with web and site related tokens

Type: SwitchParameter
Parameter Sets: (All)

Required: False
Position: Named
Accept pipeline input: 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)

Required: False
Position: Named
Accept pipeline input: 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)

Required: False
Position: Named
Accept pipeline input: False

Add-PnPProvisioningTemplate

SYNOPSIS

Adds a PnP Provisioning Template object to a tenant template

SYNTAX

Add-PnPProvisioningTemplate -SiteTemplate <ProvisioningTemplate>
-TenantTemplate <ProvisioningHierarchy>

EXAMPLES

——————EXAMPLE 1——————

Add-PnpProvisioningTemplate -TenantTemplate $tenanttemplate -SiteTemplate $sitetemplate

Adds an existing site template to an existing tenant template object

PARAMETERS

-SiteTemplate

The template to add to the tenant template

Type: ProvisioningTemplate
Parameter Sets: (All)

Required: True
Position: Named
Accept pipeline input: False

-TenantTemplate

The tenant template to add the template to

Type: ProvisioningHierarchy
Parameter Sets: (All)

Required: True
Position: Named
Accept pipeline input: True


Apply-PnPProvisioningTemplate

SYNOPSIS

Applies a site template to a web

SYNTAX

Instance

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>]

Path

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>]

EXAMPLES

——————EXAMPLE 1——————

Apply-PnPProvisioningTemplate -Path template.xml

Applies a site template in XML format to the current web.

——————EXAMPLE 2——————

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.

——————EXAMPLE 3——————

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.

——————EXAMPLE 4——————

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.

——————EXAMPLE 5——————

Apply-PnPProvisioningTemplate -Path template.pnp

Applies a site template from a pnp package to the current web.

——————EXAMPLE 6——————

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.

——————EXAMPLE 7——————


$handler1 = New-PnPExtensibilityHandlerObject -Assembly Contoso.Core.Handlers -Type Contoso.Core.Handlers.MyExtensibilityHandler1
$handler2 = New-PnPExtensibilityHandlerObject -Assembly Contoso.Core.Handlers -Type Contoso.Core.Handlers.MyExtensibilityHandler2
Apply-PnPProvisioningTemplate -Path NewTemplate.xml -ExtensibilityHandlers $handler1,$handler2

This will create two new ExtensibilityHandler objects that are run while provisioning the template

——————EXAMPLE 8——————

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.

——————EXAMPLE 9——————

Apply-PnPProvisioningTemplate -Path .\template.xml -TemplateId "MyTemplate"

Applies the ProvisioningTemplate with the ID “MyTemplate” located in the template definition file template.xml.

PARAMETERS

-ClearNavigation

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: SwitchParameter
Parameter Sets: (All)

Required: False
Position: Named
Accept pipeline input: False

-ExcludeHandlers

Allows you to run all handlers, excluding the ones specified.

Type: Handlers
Parameter Sets: __AllParameterSets

Required: False
Position: Named
Accept pipeline input: False

-ExtensibilityHandlers

Allows you to specify ExtensbilityHandlers to execute while applying a template

Type: ExtensibilityHandler[]
Parameter Sets: __AllParameterSets

Required: False
Position: Named
Accept pipeline input: False

-Handlers

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: Handlers
Parameter Sets: __AllParameterSets

Required: False
Position: Named
Accept pipeline input: False

-IgnoreDuplicateDataRowErrors

Ignore duplicate data row errors when the data row in the template already exists.

Type: SwitchParameter
Parameter Sets: __AllParameterSets

Required: False
Position: Named
Accept pipeline input: False

-InputInstance

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: ProvisioningTemplate
Parameter Sets: Instance

Required: False
Position: Named
Accept pipeline input: False

-OverwriteSystemPropertyBagValues

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: SwitchParameter
Parameter Sets: __AllParameterSets

Required: False
Position: Named
Accept pipeline input: False

-Parameters

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: Hashtable
Parameter Sets: __AllParameterSets

Required: False
Position: Named
Accept pipeline input: False

-Path

Path to the xml or pnp file containing the provisioning template.

Type: String
Parameter Sets: Path

Required: True
Position: 0
Accept pipeline input: True

-ProvisionContentTypesToSubWebs

If set content types will be provisioned if the target web is a subweb.

Type: SwitchParameter
Parameter Sets: (All)

Required: False
Position: Named
Accept pipeline input: False

-ProvisionFieldsToSubWebs

If set fields will be provisioned if the target web is a subweb.

Type: SwitchParameter
Parameter Sets: (All)

Required: False
Position: Named
Accept pipeline input: False

-ResourceFolder

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: String
Parameter Sets: __AllParameterSets

Required: False
Position: Named
Accept pipeline input: False

-TemplateId

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: String
Parameter Sets: __AllParameterSets

Required: False
Position: Named
Accept pipeline input: False

-TemplateProviderExtensions

Allows you to specify ITemplateProviderExtension to execute while applying a template.

Type: ITemplateProviderExtension[]
Parameter Sets: __AllParameterSets

Required: False
Position: Named
Accept pipeline input: 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)

Required: False
Position: Named
Accept pipeline input: 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)

Required: False
Position: Named
Accept pipeline input: False


Convert-PnPFolderToProvisioningTemplate

SYNOPSIS

Creates a pnp package file of an existing template xml, and includes all files in the current folder

SYNTAX

Convert-PnPFolderToProvisioningTemplate -Out <String>
[-Force [<SwitchParameter>]]
[-Folder <String>]

EXAMPLES

——————EXAMPLE 1——————

Convert-PnPFolderToProvisioningTemplate -Out template.pnp

Creates a pnp package file of an existing template xml, and includes all files in the current folder

——————EXAMPLE 2——————

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

PARAMETERS

-Folder

Folder to process. If not specified the current folder will be used.

Type: String
Parameter Sets: (All)

Required: False
Position: 1
Accept pipeline input: False

-Force

Overwrites the output file if it exists.

Type: SwitchParameter
Parameter Sets: (All)

Required: False
Position: Named
Accept pipeline input: False

-Out

Filename to write to, optionally including full path.

Type: String
Parameter Sets: (All)

Required: True
Position: 0
Accept pipeline input: False


Convert-PnPProvisioningTemplate

SYNOPSIS

Converts a provisioning template to an other schema version

SYNTAX

Convert-PnPProvisioningTemplate -Path <String>
[-Out <String>]
[-Encoding <Encoding>]
[-Force [<SwitchParameter>]]
[-ToSchema <XMLPnPSchemaVersion>]

EXAMPLES

——————EXAMPLE 1——————

Convert-PnPProvisioningTemplate -Path template.xml

Converts a provisioning template to the latest schema and outputs the result to current console.

——————EXAMPLE 2——————

Convert-PnPProvisioningTemplate -Path template.xml -Out newtemplate.xml

Converts a provisioning template to the latest schema and outputs the result the newtemplate.xml file.

——————EXAMPLE 3——————

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.

PARAMETERS

-Encoding

The encoding type of the XML file, Unicode is default

Type: Encoding
Parameter Sets: (All)

Required: False
Position: Named
Accept pipeline input: False

-Force

Overwrites the output file if it exists

Type: SwitchParameter
Parameter Sets: (All)

Required: False
Position: Named
Accept pipeline input: False

-Out

Filename to write to, optionally including full path

Type: String
Parameter Sets: (All)

Required: False
Position: Named
Accept pipeline input: False

-Path

Path to the xml file containing the site template

Type: String
Parameter Sets: (All)

Required: True
Position: 0
Accept pipeline input: True

-ToSchema

The schema of the output to use, defaults to the latest schema

Type: XMLPnPSchemaVersion
Parameter Sets: (All)

Required: False
Position: 1
Accept pipeline input: False


Export-PnPListToProvisioningTemplate

SYNOPSIS

Exports one or more lists to provisioning template

SYNTAX

Export-PnPListToProvisioningTemplate -List <String>
[-Out <String>]
[-Force [<SwitchParameter>]]
[-OutputInstance [<SwitchParameter>]]
[-Schema <XMLPnPSchemaVersion>]
[-Web <WebPipeBind>]
[-Connection <PnPConnection>]

EXAMPLES

——————EXAMPLE 1——————

Export-PnPListToProvisioningTemplate -Out template.xml -List "Documents"

Extracts a list to a new provisioning template including the list specified by title or ID.

——————EXAMPLE 2——————

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.

PARAMETERS

-Force

Overwrites the output file if it exists.

Type: SwitchParameter
Parameter Sets: (All)

Required: False
Position: Named
Accept pipeline input: False

-List

Specify the lists to extract, either providing their ID or their Title.

Type: String
Parameter Sets: (All)

Required: True
Position: Named
Accept pipeline input: False

-Out

Filename to write to, optionally including full path

Type: String
Parameter Sets: (All)

Required: False
Position: 0
Accept pipeline input: False

-OutputInstance

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: SwitchParameter
Parameter Sets: (All)

Required: False
Position: Named
Accept pipeline input: False

-Schema

The schema of the output to use, defaults to the latest schema

Type: XMLPnPSchemaVersion
Parameter Sets: (All)

Required: False
Position: 1
Accept pipeline input: 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)

Required: False
Position: Named
Accept pipeline input: 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)

Required: False
Position: Named
Accept pipeline input: False


Get-PnPProvisioningTemplate

SYNOPSIS

Generates a provisioning site template from a web

SYNTAX

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>]

EXAMPLES

——————EXAMPLE 1——————

Get-PnPProvisioningTemplate -Out template.pnp

Extracts a provisioning template in Office Open XML from the current web.

——————EXAMPLE 2——————

Get-PnPProvisioningTemplate -Out template.xml

Extracts a provisioning template in XML format from the current web.

——————EXAMPLE 3——————

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.

——————EXAMPLE 4——————

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.

——————EXAMPLE 5——————

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.

——————EXAMPLE 6——————

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.

——————EXAMPLE 7——————

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.

——————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-PnPProvisioningTemplate -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-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’.

——————EXAMPLE 10——————

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.

——————EXAMPLE 11——————

$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.

——————EXAMPLE 12——————

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.

——————EXAMPLE 13——————

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.

——————EXAMPLE 14——————

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.

PARAMETERS

-Configuration

Specify a JSON configuration file to configure the extraction progress.

Type: ExtractConfigurationPipeBind
Parameter Sets: (All)

Required: False
Position: Named
Accept pipeline input: 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)

Required: False
Position: Named
Accept pipeline input: False

-Encoding

The encoding type of the XML file, Unicode is default

Type: Encoding
Parameter Sets: (All)

Required: False
Position: Named
Accept pipeline input: 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)

Required: False
Position: Named
Accept pipeline input: False

-ExcludeHandlers

Allows you to run all handlers, excluding the ones specified.

Type: Handlers
Parameter Sets: (All)

Required: False
Position: Named
Accept pipeline input: False

-ExtensibilityHandlers

Allows you to specify ExtensibilityHandlers to execute while extracting a template.

Type: ExtensibilityHandler[]
Parameter Sets: (All)

Required: False
Position: Named
Accept pipeline input: False

-Force

Overwrites the output file if it exists.

Type: SwitchParameter
Parameter Sets: (All)

Required: False
Position: Named
Accept pipeline input: 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)

Required: False
Position: Named
Accept pipeline input: False

-IncludeAllClientSidePages

If specified all client side pages will be included

Type: SwitchParameter
Parameter Sets: (All)

Required: False
Position: Named
Accept pipeline input: False

-IncludeAllTermGroups

If specified, all term groups will be included. Overrides IncludeSiteCollectionTermGroup.

Type: SwitchParameter
Parameter Sets: (All)

Required: False
Position: Named
Accept pipeline input: False

-IncludeHiddenLists

If specified hidden lists will be included in the template

Type: SwitchParameter
Parameter Sets: (All)

Required: False
Position: Named
Accept pipeline input: False

-IncludeNativePublishingFiles

If specified, out of the box / native publishing files will be saved.

Type: SwitchParameter
Parameter Sets: (All)

Required: False
Position: Named
Accept pipeline input: False

-IncludeSearchConfiguration

If specified the template will contain the current search configuration of the site.

Type: SwitchParameter
Parameter Sets: (All)

Required: False
Position: Named
Accept pipeline input: False

-IncludeSiteCollectionTermGroup

If specified, all the site collection term groups will be included. Overridden by IncludeAllTermGroups.

Type: SwitchParameter
Parameter Sets: (All)

Required: False
Position: Named
Accept pipeline input: False

-IncludeSiteGroups

If specified all site groups will be included.

Type: SwitchParameter
Parameter Sets: (All)

Required: False
Position: Named
Accept pipeline input: False

-IncludeTermGroupsSecurity

If specified all the managers and contributors of term groups will be included.

Type: SwitchParameter
Parameter Sets: (All)

Required: False
Position: Named
Accept pipeline input: False

-ListsToExtract

Specify the lists to extract, either providing their ID or their Title.

Type: String
Parameter Sets: (All)

Required: False
Position: Named
Accept pipeline input: False

-Out

Filename to write to, optionally including full path

Type: String
Parameter Sets: (All)

Required: False
Position: 0
Accept pipeline input: False

-OutputInstance

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: SwitchParameter
Parameter Sets: (All)

Required: False
Position: Named
Accept pipeline input: 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)

Required: False
Position: Named
Accept pipeline input: 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)

Required: False
Position: Named
Accept pipeline input: False

-PersistPublishingFiles

If specified the files used for the publishing feature will be saved.

Type: SwitchParameter
Parameter Sets: (All)

Required: False
Position: Named
Accept pipeline input: 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)

Required: False
Position: Named
Accept pipeline input: False

-Schema

The schema of the output to use, defaults to the latest schema

Type: XMLPnPSchemaVersion
Parameter Sets: (All)

Required: False
Position: 1
Accept pipeline input: 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)

Required: False
Position: Named
Accept pipeline input: False

-TemplateDisplayName

It can be used to specify the DisplayName of the template file that will be extracted.

Type: String
Parameter Sets: (All)

Required: False
Position: Named
Accept pipeline input: False

-TemplateImagePreviewUrl

It can be used to specify the ImagePreviewUrl of the template file that will be extracted.

Type: String
Parameter Sets: (All)

Required: False
Position: Named
Accept pipeline input: False

-TemplateProperties

It can be used to specify custom Properties for the template file that will be extracted.

Type: Hashtable
Parameter Sets: (All)

Required: False
Position: Named
Accept pipeline input: False

-TemplateProviderExtensions

Allows you to specify ITemplateProviderExtension to execute while extracting a template.

Type: ITemplateProviderExtension[]
Parameter Sets: (All)

Required: False
Position: Named
Accept pipeline input: 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)

Required: False
Position: Named
Accept pipeline input: 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)

Required: False
Position: Named
Accept pipeline input: False


Get-PnPProvisioningTemplateFromGallery

SYNOPSIS

Retrieves or searches provisioning templates from the PnP Template Gallery

SYNTAX

Identity

Get-PnPProvisioningTemplateFromGallery [-Identity <Guid>]
[-Path <String>]
[-Force [<SwitchParameter>]]

Search

Get-PnPProvisioningTemplateFromGallery [-Search <String>]
[-TargetPlatform <TargetPlatform>]
[-TargetScope <TargetScope>]

EXAMPLES

——————EXAMPLE 1——————

Get-PnPProvisioningTemplateFromGallery

Retrieves all templates from the gallery

——————EXAMPLE 2——————

Get-PnPProvisioningTemplateFromGallery -Search "Data"

Searches for a templates containing the word ‘Data’ in the Display Name

——————EXAMPLE 3——————

Get-PnPProvisioningTemplateFromGallery -Identity ae925674-8aa6-438b-acd0-d2699a022edd

Retrieves a template with the specified ID

——————EXAMPLE 4——————

$template = Get-PnPProvisioningTemplateFromGallery -Identity ae925674-8aa6-438b-acd0-d2699a022edd
Apply-PnPProvisioningTemplate -InputInstance $template

Retrieves a template with the specified ID and applies it to the site.

——————EXAMPLE 5——————

$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

PARAMETERS

-Force

Type: SwitchParameter
Parameter Sets: Identity

Required: False
Position: Named
Accept pipeline input: False

-Identity

Type: Guid
Parameter Sets: Identity

Required: False
Position: Named
Accept pipeline input: False

-Path

Type: String
Parameter Sets: Identity

Required: False
Position: Named
Accept pipeline input: False

-Search

Type: String
Parameter Sets: Search

Required: False
Position: Named
Accept pipeline input: False

-TargetPlatform

Type: TargetPlatform
Parameter Sets: Search

Required: False
Position: Named
Accept pipeline input: False

-TargetScope

Type: TargetScope
Parameter Sets: Search

Required: False
Position: Named
Accept pipeline input: False


New-PnPProvisioningTemplate

SYNOPSIS

Creates a new provisioning template object

EXAMPLES

——————EXAMPLE 1——————

$template = New-PnPProvisioningTemplate

Creates a new instance of a site template object.


New-PnPProvisioningTemplateFromFolder

SYNOPSIS

Generates a provisioning template from a given folder, including only files that are present in that folder

SYNTAX

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>]

EXAMPLES

——————EXAMPLE 1——————

New-PnPProvisioningTemplateFromFolder -Out template.xml

Creates an empty provisioning template, and includes all files in the current folder.

——————EXAMPLE 2——————

New-PnPProvisioningTemplateFromFolder -Out template.xml -Folder c:\temp

Creates an empty provisioning template, and includes all files in the c:\temp folder.

——————EXAMPLE 3——————

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.

——————EXAMPLE 4——————

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

——————EXAMPLE 5——————

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.

——————EXAMPLE 6——————

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.

——————EXAMPLE 7——————

New-PnPProvisioningTemplateFromFolder -Out template.pnp

Creates an empty provisioning template as a pnp package file, and includes all files in the current folder

——————EXAMPLE 8——————

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

PARAMETERS

-AsIncludeFile

If specified, the output will only contain the <pnp:Files> element. This allows the output to be included in another template.

Type: SwitchParameter
Parameter Sets: (All)

Required: False
Position: Named
Accept pipeline input: False

-ContentType

An optional content type to use.

Type: ContentTypePipeBind
Parameter Sets: (All)

Required: False
Position: Named
Accept pipeline input: False

-Encoding

The encoding type of the XML file, Unicode is default

Type: Encoding
Parameter Sets: (All)

Required: False
Position: Named
Accept pipeline input: False

-Folder

Folder to process. If not specified the current folder will be used.

Type: String
Parameter Sets: (All)

Required: False
Position: 0
Accept pipeline input: False

-Force

Overwrites the output file if it exists.

Type: SwitchParameter
Parameter Sets: (All)

Required: False
Position: Named
Accept pipeline input: False

-Match

Optional wildcard pattern to match filenames against. If empty all files will be included.

Type: String
Parameter Sets: (All)

Required: False
Position: Named
Accept pipeline input: False

-Out

Filename to write to, optionally including full path.

Type: String
Parameter Sets: (All)

Required: False
Position: 0
Accept pipeline input: False

-Properties

Additional properties to set for every file entry in the generated template.

Type: Hashtable
Parameter Sets: (All)

Required: False
Position: Named
Accept pipeline input: False

-Schema

The schema of the output to use, defaults to the latest schema

Type: XMLPnPSchemaVersion
Parameter Sets: (All)

Required: False
Position: 1
Accept pipeline input: False

-TargetFolder

Target folder to provision to files to. If not specified, the current folder name will be used.

Type: String
Parameter Sets: (All)

Required: False
Position: 1
Accept pipeline input: 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)

Required: False
Position: Named
Accept pipeline input: 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)

Required: False
Position: Named
Accept pipeline input: False


Read-PnPProvisioningTemplate

SYNOPSIS

Loads/Reads a PnP file from the file system or a string

SYNTAX

By Path

Read-PnPProvisioningTemplate -Path <String>
[-TemplateProviderExtensions <ITemplateProviderExtension[]>]

By XML

Read-PnPProvisioningTemplate -Xml <String>
[-TemplateProviderExtensions <ITemplateProviderExtension[]>]

EXAMPLES

——————EXAMPLE 1——————

Read-PnPProvisioningTemplate -Path template.pnp

Loads a PnP file from the file system

——————EXAMPLE 2——————

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.

——————EXAMPLE 3——————

Read-PnPProvisioningTemplate -Xml $xml

Reads a PnP Provisioning template from a string containing the XML of a provisioning template

PARAMETERS

-Path

Filename to read from, optionally including full path.

Type: String
Parameter Sets: By Path

Required: True
Position: 0
Accept pipeline input: False

-TemplateProviderExtensions

Allows you to specify ITemplateProviderExtension to execute while loading the template.

Type: ITemplateProviderExtension[]
Parameter Sets: __AllParameterSets

Required: False
Position: Named
Accept pipeline input: False

-Xml

Variable to read from, containing the valid XML of a provisioning template.

Type: String
Parameter Sets: By XML

Required: True
Position: 1
Accept pipeline input: False

Remove-PnPFileFromProvisioningTemplate

SYNOPSIS

Removes a file from a PnP Provisioning Template

SYNTAX

Remove-PnPFileFromProvisioningTemplate -Path <String>
-FilePath <String>
[-TemplateProviderExtensions <ITemplateProviderExtension[]>]

EXAMPLES

——————EXAMPLE 1——————

Remove-PnPFileFromProvisioningTemplate -Path template.pnp -FilePath filePath

Removes a file from an in-memory PnP Provisioning Template

PARAMETERS

-FilePath

The relative File Path of the file to remove from the in-memory template

Type: String
Parameter Sets: (All)

Required: True
Position: 1
Accept pipeline input: False

-Path

Filename to read the template from, optionally including full path.

Type: String
Parameter Sets: (All)

Required: True
Position: 0
Accept pipeline input: False

-TemplateProviderExtensions

Allows you to specify ITemplateProviderExtension to execute while saving the template.

Type: ITemplateProviderExtension[]
Parameter Sets: (All)

Required: False
Position: 2
Accept pipeline input: False


Save-PnPProvisioningTemplate

SYNOPSIS

Saves a PnP site template to the file system

SYNTAX

Save-PnPProvisioningTemplate -Template <ProvisioningTemplatePipeBind>
-Out <String>
[-Schema <XMLPnPSchemaVersion>]
[-Force [<SwitchParameter>]]
[-TemplateProviderExtensions <ITemplateProviderExtension[]>]

EXAMPLES

——————EXAMPLE 1——————

Save-PnPProvisioningTemplate -Template .\template.xml -Out .\template.pnp

Saves a PnP provisioning template to the file system as a PnP file.

——————EXAMPLE 2——————

$template = Read-PnPProvisioningTemplate -Path template.xml
Save-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

——————EXAMPLE 3——————

$template = Read-PnPProvisioningTemplate -Path template.xml
Save-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.

——————EXAMPLE 4——————

Read-PnPProvisioningTemplate -Path template.xml | Save-PnPProvisioningTemplate -Out .\template.pnp

Saves a PnP site template to the file system as a PnP file.

PARAMETERS

-Force

Specifying the Force parameter will skip the confirmation question.

Type: SwitchParameter
Parameter Sets: (All)

Required: False
Position: Named
Accept pipeline input: False

-Out

Filename to write to, optionally including full path.

Type: String
Parameter Sets: (All)

Required: True
Position: 0
Accept pipeline input: False

-Schema

The optional schema to use when creating the PnP file. Always defaults to the latest schema.

Type: XMLPnPSchemaVersion
Parameter Sets: (All)

Required: False
Position: Named
Accept pipeline input: False

-Template

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: ProvisioningTemplatePipeBind
Parameter Sets: (All)
Aliases: InputInstance

Required: True
Position: Named
Accept pipeline input: True

-TemplateProviderExtensions

Allows you to specify the ITemplateProviderExtension to execute while saving a template.

Type: ITemplateProviderExtension[]
Parameter Sets: (All)

Required: False
Position: Named
Accept pipeline input: False


Set-PnPProvisioningTemplateMetadata

SYNOPSIS

Sets metadata of a provisioning template

SYNTAX

Set-PnPProvisioningTemplateMetadata -Path <String>
[-TemplateDisplayName <String>]
[-TemplateImagePreviewUrl <String>]
[-TemplateProperties <Hashtable>]
[-TemplateProviderExtensions <ITemplateProviderExtension[]>]
[-Web <WebPipeBind>]
[-Connection <PnPConnection>]

EXAMPLES

——————EXAMPLE 1——————

Set-PnPProvisioningTemplateMetadata -Path template.xml -TemplateDisplayName "DisplayNameValue"

Sets the DisplayName property of a site template in XML format.

——————EXAMPLE 2——————

Set-PnPProvisioningTemplateMetadata -Path template.pnp -TemplateDisplayName "DisplayNameValue"

Sets the DisplayName property of a site template in Office Open XML format.

——————EXAMPLE 3——————

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.

——————EXAMPLE 4——————

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.

——————EXAMPLE 5——————

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.

——————EXAMPLE 6——————

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.

PARAMETERS

-Path

Path to the xml or pnp file containing the site template.

Type: String
Parameter Sets: (All)

Required: True
Position: 0
Accept pipeline input: True

-TemplateDisplayName

It can be used to specify the DisplayName of the template file that will be updated.

Type: String
Parameter Sets: (All)

Required: False
Position: Named
Accept pipeline input: False

-TemplateImagePreviewUrl

It can be used to specify the ImagePreviewUrl of the template file that will be updated.

Type: String
Parameter Sets: (All)

Required: False
Position: Named
Accept pipeline input: False

-TemplateProperties

It can be used to specify custom Properties for the template file that will be updated.

Type: Hashtable
Parameter Sets: (All)

Required: False
Position: Named
Accept pipeline input: False

-TemplateProviderExtensions

Allows you to specify ITemplateProviderExtension to execute while extracting a template.

Type: ITemplateProviderExtension[]
Parameter Sets: (All)

Required: False
Position: Named
Accept pipeline input: 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)

Required: False
Position: Named
Accept pipeline input: 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)

Required: False
Position: Named
Accept pipeline input: False