Forum Discussion

huntaj's avatar
huntaj
Copper Contributor
Jan 14, 2022

Using PowerShell To Find ID of Template From Your Organization

Hi all, 

 

I am trying to automate the process of applying a site template within our organization to a series of new sites we are going to be creating for a SharePoint Intranet. 

 

When I manually open the site in a browser, click settings, and click Apply a Site Template, I can clearly see our available organization templates in the "From your organization" tab, seen below: 

We have one called "CofC Team Site" and one called "CofC Communication Site". These templates were implemented and added to our environment by a vendor. 

 

I am simply trying to use the https://docs.microsoft.com/en-us/powershell/module/sharepoint-pnp/invoke-pnpsitetemplate?view=sharepoint-ps command from the PnP.Powershell module to invoke (apply) one of these templates (either of them; if I can get one working I'll know how to do the other) to a new site collection. 

 

What I've Tried So Far

I have tried manually applying the CofC Team Site template to a new Team site, and then using the https://docs.microsoft.com/en-us/powershell/module/sharepoint-pnp/get-pnpwebtemplates?view=sharepoint-ps command to save the template of that new site to an XML file, and then using Invoke-PnPSiteTemplate -Path <that XML file> -Connection <connection to another site to which the template has not been applied yet>. However, that gives this error: 

https://github.com/pnp/pnpframework/issues/164

which no one has solved. 

 

So, another available argument to the Invoke-PnPSiteTemplate is the template ID. Does anyone know how to get the IDs of the templates in the "From your organization" tab (in the screenshot above)?

No RepliesBe the first to reply

Resources