Add-PnPFileToProvisioningTemplate

Adds a file to a PnP Provisioning Template

Syntax

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

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

-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:SPOnlineConnection
Position:Named
Accept pipeline input:False
Accept wildcard characters:False
-Container

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

Type:String
Position:3
Accept pipeline input:False
Accept wildcard characters:False
-FileLevel

The level of the files to add. Defaults to Published

Type:FileLevel
Position:4
Accept pipeline input:False
Accept wildcard characters:False
-FileOverwrite

Set to overwrite in site, Defaults to true

Type:SwitchParameter
Position:5
Accept pipeline input:False
Accept wildcard characters:False
-Folder

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

Type:String
Position:2
Accept pipeline input:False
Accept wildcard characters:False
-Path

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

Type:String
Position:0
Accept pipeline input:False
Accept wildcard characters:False
-Source

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

Type:String
Position:1
Accept pipeline input:False
Accept wildcard characters:False
-SourceUrl

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

Type:String
Position:1
Accept pipeline input:False
Accept wildcard characters:False
-TemplateProviderExtensions

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

Type:ITemplateProviderExtension[]
Position:4
Accept pipeline input:False
Accept wildcard characters:False
-Web

This parameter allows you to optionally apply the cmdlet action to a subweb within the current web. In most situations this parameter is not required and you can connect to the subweb using Connect-PnPOnline instead. Specify the GUID, server relative url (i.e. /sites/team1) or web instance of the web to apply the command to. Omit this parameter to use the current web.

Type:WebPipeBind
Position:Named
Accept pipeline input:False
Accept wildcard characters:False