Get-PnPSiteTemplate fails when used on site created with a default template
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 259
- Forks
- 161
- Avg merge
- 10h 33m
- Merged PRs (30d)
- 1
Description
Error description
I've created a communication site, with the default site template "Department" applied. No further modifications have been made to site.
When trying to extract the site template from a communication site with all site pages, it fails with the following error message:
Get-PnPSiteTemplate : The JSON value could not be converted to System.Int32. Path:
$.position.sectionIndex | LineNumber: 0 | BytePositionInLine: 107.
The error message appears when PnP is trying to extract the client side page contents, so I assume, the JSON of the default pages contains data, which does not follow the schema PnP is expecting.
The used command is
Get-PnPSiteTemplate -Out "template.xml" -IncludeAllClientSidePages
Steps to reproduce
- Make sure, you have the latest PnP.PowerShell installed (in my case 1.11.0)
- Create a new communication site (English language)
- When you first open the site, select "Browse templates" in the upcoming dialog
- Select the "Department" template and wait, until it is applied completely
- Connect to the site using PnP with
Connect-PnPOnline https://yourtenant.sharepoint.com/sites/yoursite -Interactive - Extract a template including all site pages with
Get-PnPSiteTemplate -Out "template.xml" -IncludeAllClientSidePages
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the failure with Connect-PnPOnline and Get-PnPSiteTemplate using -IncludeAllClientSidePages on a communication site with the Department template. Start by tracing the client-side page extraction and the JSON value at position.sectionIndex; done means the complete template, including all site pages, is extracted without the Int32 conversion error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100