Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
yetao opened this issue Nov 4, 2022 · 4 comments
Open

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

yetao opened this issue Nov 4, 2022 · 4 comments

Comments

@yetao
Copy link

yetao commented Nov 4, 2022

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

@plamber
Copy link

plamber commented Nov 14, 2022

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
Copy link

plamber commented Nov 14, 2022

This issue seems to be related #743

@vinaunder
Copy link

Any news about this problem?

@PedroMordeP
Copy link
Contributor

PedroMordeP commented May 31, 2023

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

pnp/pnpcore#1058

I updated my PnP.Framework and resolved the issue
pnp/pnpcore#1180

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants