pnp / pnp/pnpframework

Get-PnPSiteTemplate fails when used on site created with a default template

Open
#710 1 comment 0 reactions 0 assignees View on GitHub

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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.