pnpframework icon indicating copy to clipboard operation
pnpframework copied to clipboard

The JSON value could not be converted to System.Int32.

Open yetao opened this issue 2 years ago • 4 comments

Hello,

I'm having the following issue when trying to run the following command over an specific site:

Get-PnPSiteTemplate -Connection $connection -Out $output -Encoding ([System.Text.Encoding]::UTF8) -IncludeAllPages -IncludeAllTermGroups -IncludeNativePublishingFiles -IncludeSearchConfiguration -PersistBrandingFiles -PersistPublishingFiles -Force

Everything goes normal until I get this error in debug output: Extracting Template from https://n36j.sharepoint.com/sites/S… [Client Side Page Contents ] 81167717-0a13-41cc-9b59-8cd7924a2669 Get-PnPSiteTemplate: /tmp/regress/bin/M365-SP-Backup-Site.ps1:53 ed1677172292ms4181167717-0a13-41cc-9b59-8cd7924a2669 Line | 81167717-0a13-41cc-9b59-8cd7924a2669b59-8cd7924a2669 53 | Get-PnPSiteTemplate -Connection $connection -Out $output -Encodin …
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| The JSON value could not be converted to System.Int32. Path: $.position.sectionIndex | LineNumber: 0 | BytePositionInLine: 107.

This is happening using PnP.Powershell in latest version (1.11.0), but also in the most recent nightly (1.11.124-nightly). I'm opening the issue here as it's what they suggest in their git repo: ...

  1. Are you using Invoke-PnPSiteTemplate or Get-PnPSiteTemplate? The issue is most likely related to the Provisioning Engine. The Provisioning engine is not located in the PowerShell repo. Please report the issue here: https://github.com/pnp/pnpframework/issues. ...

How could I investigate further this problem?

Thanks for any help. Best regards, Jorge

yetao avatar Nov 04 '22 15:11 yetao

Hello @jansenbe and @pkbullock, I noticed the same error. It seems to be a problem with the PagesContents Handler and the Image WebPart. These are the steps to reproduce it.

  • Create a communication site
  • Apply the site template "Leadership connection"
  • Run the PowerShell command or CSOM command below
  • It will fail for the page "Contoso-Leadership.aspx" with the error The JSON value could not be converted to System.Int32
  • By removing the image WebPart the "Contoso-Leadership.aspx" is properly exported
Get-PnPSiteTemplate .\template.pnp -Handlers Pages,PageContents -IncludeAllClientSidePages -PersistBrandingFiles -Debug
ProvisioningTemplateCreationInformation creationInformation = new ProvisioningTemplateCreationInformation(context.Web);
creationInformation.PersistPublishingFiles = true;
creationInformation.IncludeAllClientSidePages = true;
creationInformation.HandlersToProcess = handlers;
context.Web.GetProvisioningTemplate(creationInformation);

Cheers

plamber avatar Nov 14 '22 05:11 plamber

This issue seems to be related https://github.com/pnp/pnpframework/issues/743

plamber avatar Nov 14 '22 06:11 plamber

Any news about this problem?

vinaunder avatar Feb 01 '23 22:02 vinaunder

I think this is resolved on the PnP.Core in version 1.9, just update the references to this version

https://github.com/pnp/pnpcore/pull/1058

I updated my PnP.Framework and resolved the issue https://github.com/pnp/pnpcore/issues/1180

PedroMordeP avatar May 31 '23 11:05 PedroMordeP