pnp / pnp/pnpframework

Applying a site template causes PnP export template to crash

Open
#649 0 comments 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

Applying a site template changes the CanvasPosition's SectionIndex from an int to a float value (e.g. 1 becomes 1.0). The JSON deserializer throws an error because of this. The format change can be seen when inspecting the CanvasContent1 property of a SharePoint page before and after applying a site template.

Changing the SectionIndex definition to be a float or double seems to be the easy solution here?

PnP.Framework 1.9.0 was used, using this line:
context.Web.GetProvisioningTemplate(templateInfo);

Line that throws error:
https://github.com/pnp/pnpcore/blob/dev/src/sdk/PnP.Core/Model/SharePoint/Pages/Internal/CanvasControl.cs#L331

CanvasPosition definition:
https://github.com/pnp/pnpcore/blob/999ab6da6da004b7f51965915837c0f6df4a81e7/src/sdk/PnP.Core/Model/SharePoint/Pages/Internal/CanvasPosition.cs#L21

image

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

Start at src/sdk/PnP.Core/Model/SharePoint/Pages/Internal/CanvasControl.cs around line 331 and compare it with the CanvasPosition definition in src/sdk/PnP.Core/Model/SharePoint/Pages/Internal/CanvasPosition.cs. Reproduce the failure through context.Web.GetProvisioningTemplate(templateInfo) using a page whose CanvasContent1 contains a decimal SectionIndex. Done means the template export succeeds for both integer and decimal SectionIndex values.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
backend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
50/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.