pnp / pnp/powershell

[BUG] Resources Web Part is not handled by Get-PnPSiteTemplate

Open
#5,375 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
C#
Stars
904
Forks
407
Avg merge
9h 16m
Merged PRs (30d)
10

Description

If a site has a Resources Web Part on a page, it isn't exported in such a way as it can be reinstantiated with the template. I'm not sure if this makes sense to fix or if the architecture sort of prevents it. In any case...

When we export the site with Get-PnPSiteTemplate, the Resources Web Part ends up looking like this:

<pnp:CanvasControl WebPartType="Custom"
    JsonControlData="{&quot;webPartId&quot;:&quot;fde8ea95-fcbd-4967-abb5-a388e8e2ddfa&quot;,&quot;rteInstanceId&quot;:null,&quot;addedFromPersistedData&quot;:true,&quot;reservedHeight&quot;:218,&quot;reservedWidth&quot;:1204,&quot;controlType&quot;:3,&quot;id&quot;:&quot;2e94fed0-8018-450c-ac2f-4398f843d468&quot;,&quot;position&quot;:{&quot;controlIndex&quot;:5,&quot;zoneIndex&quot;:4,&quot;sectionIndex&quot;:1,&quot;sectionFactor&quot;:100,&quot;layoutIndex&quot;:1,&quot;zoneId&quot;:&quot;505d8621-8e3b-421b-8d0a-c4077e1d72cf&quot;},&quot;emphasis&quot;:{&quot;zoneEmphasis&quot;:0},&quot;flexibleLayoutPosition&quot;:{&quot;lg&quot;:{&quot;x&quot;:0,&quot;y&quot;:8,&quot;w&quot;:70,&quot;h&quot;:13}},&quot;properties&quot;:{&quot;items&quot;:[],&quot;isMigrated&quot;:true,&quot;layoutId&quot;:&quot;Stack&quot;,&quot;shouldShowThumbnail&quot;:true,&quot;isTitleEnabled&quot;:true,&quot;isAudienceTargetingEnabled&quot;:true,&quot;hideWebPartWhenEmpty&quot;:true,&quot;listLayoutOptions&quot;:{&quot;showDescription&quot;:false,&quot;showIcon&quot;:true},&quot;showCardMotion&quot;:true,&quot;dataProviderId&quot;:&quot;Resources&quot;,&quot;webId&quot;:&quot;{siteid}&quot;,&quot;siteId&quot;:&quot;{sitecollectionid}&quot;,&quot;thumbnail_type&quot;:1,&quot;imagePicker&quot;:&quot;https://{fqdn}{site}/SiteAssets/SitePages/Home/sustainability-report@2x.png&quot;,&quot;Title&quot;:&quot;ECS Report&quot;,&quot;titleHTML&quot;:&quot;&lt;h2 class=\&quot;headingSpacingAbove headingSpacingBelow lineHeight1_4\&quot;&gt;&lt;span class=\&quot;fontSizeXLarge\&quot;&gt;Resources&lt;/span&gt;&lt;/h2&gt;&quot;,&quot;pane_link_button&quot;:0},&quot;serverProcessedContent&quot;:{&quot;htmlStrings&quot;:{},&quot;searchablePlainTexts&quot;:{&quot;title&quot;:&quot;Resources&quot;},&quot;imageSources&quot;:{},&quot;links&quot;:{&quot;baseUrl&quot;:&quot;https://{fqdn}{site}&quot;},&quot;componentDependencies&quot;:{&quot;layoutComponentId&quot;:&quot;706e33c8-af37-4e7b-9d22-6e5694d92a6f&quot;}},&quot;dynamicDataPaths&quot;:{},&quot;dynamicDataValues&quot;:{},&quot;dataVersion&quot;:&quot;1.0&quot;}"
    ControlId="fde8ea95-fcbd-4967-abb5-a388e8e2ddfa" Order="5" Column="1" />

This doesn't contain the information required to recreate it and have it be healthy. But it's complicated.

After some spelunking, I found where the Resources links are stored. They are in a hidden list called "ConnectionsConfiguration-4ce1892f-76d2-4393-b9df-079a66a95c4a". That list has one item in it called "VC Configuration". That item has a column called Spotlight_x0020_Configuration which holds the links.

Here's an example payload:

{
    "SpotlightConfiguration": null,
    "CompanyLinks": [
        {
            "Title": "Employee Handbook",
            "Url": "https://aka.ms/ngia-samples",
            "Icon": "https://spex003.sharepoint.com/sites/Solbound/SiteAssets/SitePages/Home/eployee-handbook@2x.png",
            "Id": 1,
            "Audiences": [],
            "ThumbnailOption": "Custom"
        },
        {
            "Title": "Org Chart",
            "Url": "https://aka.ms/ngia-samples",
            "Icon": "https://spex003.sharepoint.com/sites/Solbound/SiteAssets/SitePages/Home/org-chart@2x.png",
            "Id": 2,
            "Audiences": [],
            "ThumbnailOption": "Custom"
        },
        {
            "Title": "Brand Assets",
            "Url": "https://aka.ms/ngia-samples",
            "Icon": "https://spex003.sharepoint.com/sites/Solbound/SiteAssets/SitePages/Home/brand-assets@2x.png",
            "Id": 3,
            "Audiences": [],
            "ThumbnailOption": "Custom"
        },
        {
            "Title": "Internal Jobs",
            "Url": "https://aka.ms/ngia-samples",
            "Icon": "https://spex003.sharepoint.com/sites/Solbound/SiteAssets/SitePages/Home/Internal-job-board@2x.png",
            "Id": 4,
            "Audiences": [],
            "ThumbnailOption": "Custom"
        },
        {
            "Title": "Benefits & Insurance",
            "Url": "https://aka.ms/ngia-samples",
            "Icon": "https://spex003.sharepoint.com/sites/Solbound/SiteAssets/SitePages/Home/benefits-insurance@2x.png",
            "Id": 5,
            "Audiences": [],
            "ThumbnailOption": "Custom"
        },
        {
            "Title": "Pay Stubs & Payroll",
            "Url": "https://aka.ms/ngia-samples",
            "Icon": "https://spex003.sharepoint.com/sites/Solbound/SiteAssets/SitePages/Home/pay-stubs@2x.png",
            "Id": 6,
            "Audiences": [],
            "ThumbnailOption": "Custom"
        },
        {
            "Title": "Training Library",
            "Url": "https://aka.ms/ngia-samples",
            "Icon": "https://spex003.sharepoint.com/sites/Solbound/SiteAssets/SitePages/Home/training-library@2x.png",
            "Id": 7,
            "Audiences": [],
            "ThumbnailOption": "Custom"
        },
        {
            "Title": "ECS Report",
            "Url": "https://aka.ms/ngia-samples",
            "Icon": "https://spex003.sharepoint.com/sites/Solbound/SiteAssets/SitePages/Home/sustainability-report@2x.png",
            "Id": 8,
            "Audiences": [],
            "ThumbnailOption": "Custom"
        }
    ],
    "TitleRegion": null
}

Contributor guide

Open the contributing guide

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 the Get-PnPSiteTemplate export and corresponding template-import handling, then trace how the Resources Web Part is represented in CanvasControl data. Investigate the ConnectionsConfiguration-4ce1892f-76d2-4393-b9df-079a66a95c4a list and its Spotlight_x0020_Configuration column. Done means a site containing this web part exports the required links and can recreate a healthy web part from the template.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, powershell
Domain
backend, cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.