New-PnPProvisioningTemplateFromFolder

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

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

Optional connection to be used by the cmdlet. Retrieve the value for this parameter by either specifying -ReturnConnection on Connect-PnPOnline or by executing Get-PnPConnection.

Type:SPOnlineConnection
Position:Named
Accept pipeline input:False
Accept wildcard characters:False
-ContentType

An optional content type to use.

Type:ContentTypePipeBind
Position:Named
Accept pipeline input:False
Accept wildcard characters:False
-Encoding

The encoding type of the XML file, Unicode is default

Type:Encoding
Position:Named
Accept pipeline input:False
Accept wildcard characters:False
-Folder

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

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

Overwrites the output file if it exists.

Type:SwitchParameter
Position:Named
Accept pipeline input:False
Accept wildcard characters:False
-Match

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

Type:String
Position:Named
Accept pipeline input:False
Accept wildcard characters:False
-Out

Filename to write to, optionally including full path.

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

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

Type:Hashtable
Position:Named
Accept pipeline input:False
Accept wildcard characters:False
-Schema

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

Type:XMLPnPSchemaVersion
Position:1
Accept pipeline input:False
Accept wildcard characters:False
-TargetFolder

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

Type:String
Position:1
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