[BUG] Get-PnPSiteTemplate Error While Generating Template
See original GitHub issueReporting an Issue or Missing Feature
The Get-PnPSiteTemplate
is failing to create a template for a given site. I’ve tested the site beforehand with Test-PnPSite
and no errors were found.
Expected behavior
The Get-PnPSiteTemplate
command should create an XML template representing the given site.
Actual behavior
The command is returning the following error:
Get-PnPSiteTemplate : Oops...seems we end up here anyway...check PnP.Framework code to understand what was here
At C:\Users\joaosalgado\workspace\SharePointBackupTools\src\Export-SharePointSiteTemplate.ps1:45 char:9
+ Get-PnPSiteTemplate `
+ ~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : WriteError: (:) [Get-PnPSiteTemplate], Exception
+ FullyQualifiedErrorId : EXCEPTION,PnP.PowerShell.Commands.Provisioning.Site.GetSiteTemplate
After running Get-PnPException
I got the following stack:
Message : Oops...seems we end up here anyway...check PnP.Framework code to understand what was here
Stacktrace : at PnP.Core.Model.SharePoint.PageWebPart.FromHtml(IElement element)
at PnP.Core.Model.SharePoint.Page.LoadFromHtml(String html, String pageHeaderHtml)
at PnP.Core.Model.SharePoint.Page.<LoadPageAsync>d__121.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at PnP.Core.Model.SharePoint.Page.<LoadPagesAsync>d__93.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at PnP.Core.Model.SharePoint.Web.<GetPagesAsync>d__282.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at PnP.Core.Model.SharePoint.Web.GetPages(String pageName)
at Microsoft.SharePoint.Client.PageExtensions.LoadClientSidePage(Web web, String pageName)
at PnP.Framework.Provisioning.ObjectHandlers.Utilities.ClientSidePageContentsHelper.ExtractClientSidePage(Web
web, ProvisioningTemplate template, ProvisioningTemplateCreationInformation creationInfo, PnPMonitoredScope
scope, PageToExport page)
at PnP.Framework.Provisioning.ObjectHandlers.ObjectClientSidePageContents.ExtractObjects(Web web,
ProvisioningTemplate template, ProvisioningTemplateCreationInformation creationInfo)
at PnP.Framework.Provisioning.ObjectHandlers.SiteToTemplateConversion.GetRemoteTemplate(Web web,
ProvisioningTemplateCreationInformation creationInfo)
at PnP.PowerShell.Commands.Provisioning.Site.GetSiteTemplate.ExtractTemplate(XMLPnPSchemaVersion schema,
String path, String packageName, ExtractConfiguration configuration)
at PnP.PowerShell.Commands.Provisioning.Site.GetSiteTemplate.ExecuteCmdlet()
at PnP.PowerShell.Commands.PnPSharePointCmdlet.ProcessRecord()
Steps to reproduce behavior
Just run the following command in a Powershell session.
Get-PnPSiteTemplate `
-Out $TemplatePath `
-IncludeAllTermGroups `
-IncludeSiteCollectionTermGroup `
-IncludeSiteGroups `
-PersistBrandingFiles `
-PersistPublishingFiles `
-IncludeNativePublishingFiles `
-IncludeAllPages `
-Handlers All `
-Schema LATEST `
-Force;
What is the version of the Cmdlet module you are running?
1.5.0
Which operating system/environment are you running PnP PowerShell on?
- Windows
- Linux
- MacOS
- Azure Cloud Shell
- Azure Functions
- Other : please specify
Issue Analytics
- State:
- Created 2 years ago
- Comments:12 (3 by maintainers)
Top Results From Across the Web
"Method Not Found" Error while using Get-PnPSiteTemplate
Sounds like there is a bug with the most recent version (v1.7 and ... Get-PnPProvisioningTemplate is not recognized as the name of a...
Read more >Get-PnPSiteTemplate : Attempted to perform an ...
I am trying to export a design template for a site that I am in the Owners group for, and I have Share...
Read more >Apply-PnPProvisioningTemplate : File not Found
There is a bug in the provisioning schema causing this error. try to find the field Name="_DisplayName" within your template.xml (there are ...
Read more >PnP Provisioning Template error - Invalid template URL
My source site contains a library with a folder content type that includes a description field. Is that what may be causing the...
Read more >Why does Apply-PnPProvisioningTemplate PNP command ...
As a general rule: use only characters (not even numbers) in column names. Don't use spaces, dashes, underscores, or anything other than ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yeah, exactly. Here is a snippet of my template extraction code:
And the script that applies the templates:
It works flawlessly for team and communication sites. No throttle or disconnections during the entire process which took around 1 hour in a 150mbits/s network.
Hi @jansenbe! So, I checked all of my pages and none of them contain 3rd party web parts or additional controls in their headers. Actually, most of my pages are just plain text with a few tables. Currently, as a workaround, I decided to create a template for every single page of my website using
Export-PnPClientSidePage
and later on iterating through each .XML file publishing the templates withExport-PnPClientSidePage
. I will give the nightly builds a try tonight.