Add-PnPFileToSiteTemplate
SYNOPSIS
Adds a file to a PnP Provisioning Template
SYNTAX
Local File
Add-PnPFileToSiteTemplate [-Path] <String> [-Source] <String> [-Folder] <String>
[[-Container] <String>] [[-FileLevel] <FileLevel>] [-FileOverwrite]
[[-TemplateProviderExtensions] <ITemplateProviderExtension[]>] [-Web <WebPipeBind>]
[-Connection <PnPConnection>] [<CommonParameters>]
Remove File
Add-PnPFileToSiteTemplate [-Path] <String> [-SourceUrl] <String> [[-Container] <String>]
[[-FileLevel] <FileLevel>] [-FileOverwrite] [[-TemplateProviderExtensions] <ITemplateProviderExtension[]>]
[-Web <WebPipeBind>] [-Connection <PnPConnection>] [<CommonParameters>]
DESCRIPTION
EXAMPLES
EXAMPLE 1
Add-PnPFileToSiteTemplate -Path template.pnp -Source $sourceFilePath -Folder $targetFolder
Adds a file to a PnP Site Template
EXAMPLE 2
Add-PnPFileToSiteTemplate -Path template.xml -Source $sourceFilePath -Folder $targetFolder
Adds a file reference to a PnP Site XML Template
EXAMPLE 3
Add-PnPFileToSiteTemplate -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-PnPFileToSiteTemplate -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-PnPFileToSiteTemplate -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: PnPConnection
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
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
Parameter Sets: (All)
Aliases:
Required: False
Position: 3
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-FileLevel
The level of the files to add. Defaults to Published
Type: FileLevel
Parameter Sets: (All)
Aliases:
Required: False
Position: 4
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-FileOverwrite
Set to overwrite in site, Defaults to true
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: 5
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Folder
The target Folder for the file to add to the in-memory template.
Type: String
Parameter Sets: Local File
Aliases:
Required: True
Position: 2
Default value: None
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
Parameter Sets: (All)
Aliases:
Required: True
Position: 0
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Source
The file to add to the in-memory template, optionally including full path.
Type: String
Parameter Sets: Local File
Aliases:
Required: True
Position: 1
Default value: None
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
Parameter Sets: Remove File
Aliases:
Required: True
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-TemplateProviderExtensions
Allows you to specify ITemplateProviderExtension to execute while loading the template.
Type: ITemplateProviderExtension[]
Parameter Sets: (All)
Aliases:
Required: False
Position: 4
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Web
This parameter allows you to optionally apply the cmdlet action to a subweb within the current web. In most situations this parameter is not required and you can connect to the subweb using Connect-PnPOnline instead. Specify the GUID, server relative url (i.e. /sites/team1) or web instance of the web to apply the command to. Omit this parameter to use the current web.
Type: WebPipeBind
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False