How to get a PnP template using PowerShell and then apply in MS Flow

This article will show how to create a PnP template via PowerShell. As a result we'll have an XML file which can be used with Plumsail SharePoint connector Provision PnP template to SharePoint .

Create a SharePoint list with custom columns

First of all you need to install SharePoint PnP library of PowerShell commands. Microsoft provides 3 ways to install the cmdlets and you can find them in the official MS article .

After installing the cmdlets you need to connect to your SharePoint site:

Connect-PnPOnline -Url https://mycompany.sharepoint.com/sites/mysite

or in case of multi-factor authentication use

Connect-PnPOnline -Url https://yoursite.sharepoint.com -UseWebLogin

There are 2 available commands to get a template:

Get-PnPProvisioningTemplate

and

Get-PnPProvisioningTemplateFromGallery

First one creates a provisioning site template, including all data and all settings. Second - creates template from existing templates and searches the galery.

You can find more information about the commands and available options in official MIcrosoft documentation .

We'll use first command

Get-PnPProvisioningTemplate -Out path

You can also modify already created provisioning template using other PnP functions.

After that we can get the file in MS flow and select it in Provision PnP template to SharePoint .

flow

Conclusion

PowerShell PnP provides many usefull functions to create and modify PnP provisioning templates. However, you can also create a PnP template manually and insert PnP code directly into Plumsail Provision PnP template to SharePoint If you haven’t used it yet, registering an account would be the first step. It is quite easy to get started.

flow1