Skip to content
Back to skills

Pp365 Templates

ASecurity

How content reaches Prosjektportalen 365 sites and existing installations: the hub PnP templates, the JSON project templates the setup wizard applies, their .resx texts, site scripts, channel ids, and the install and upgrade scripts. Use when asked to "add a field", "new project property", "show a property in Prosjektinformasjon", "site column", "content type", "add a list", "seed rows", "Prosjektkolonner", "Maloppsett", "global setting", "Portfolio.xml", "JSON template", "Standardmal", "proj...

  • 35 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added November 13, 2026
documentationtypescriptgonodetestinggitsecurity

Works with

  • cli

Security analysis

A100/100

Scanned November 13, 2026

npx -y skills add Puzzlepart/prosjektportalen365 --skill pp365-templates --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Pp365 Templates?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Pp365 Templates
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/puzzlepart-pp365-templates/badge)](https://www.skillsdirectory.com/skills/puzzlepart-pp365-templates)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: pp365-templates
description: 'How content reaches Prosjektportalen 365 sites and existing installations: the hub PnP templates, the JSON project templates the setup wizard applies, their .resx texts, site scripts, channel ids, and the install and upgrade scripts. Use when asked to "add a field", "new project property", "show a property in Prosjektinformasjon", "site column", "content type", "add a list", "seed rows", "Prosjektkolonner", "Maloppsett", "global setting", "Portfolio.xml", "JSON template", "Standardmal", "project setup", "sp-js-provisioning", "resx", "SharedResources", "term set", "site script", "generate-channel-config", "upgrade existing hubs or projects", "Install.ps1 -Upgrade", "PreInstallUpgrade", "PostInstallUpgrade", "UpgradeAllSitesToLatest", "Ensure script", "managed property", "template catalog". Pair with pp365-release for CI tags and runs, and pp365-toolchain for builds and dependency bumps.'
argument-hint: 'Describe the content change (field, content type, list, page, setting, term, site script) and whether existing hubs and projects must get it'
---

# PP365 templates, provisioning and upgrades

Read first (Norwegian):
- `.development-guide/maler/maler.md`, `js-provisjoneringsmal.md` (`Parameters`, `TermSetIds`), `kanaler.md` and `site-design-og-site-scripts.md`. They predate the current layout (they name `_JsonTemplate.json`, Templates-root `.ps1` scripts and `Portfolio_content_BA` files that no longer exist); where they disagree with this skill, the code wins.
- `Templates/README.md` (resx to `SharedResources`) and `.development-guide/spfx/npm-skript.md`, "Skript i `Templates`" (current).
- CI tags: `.development-guide/ci/kontinuerlig-integrasjon.md` and pp365-release.
- The guide has no chapter on adding a project property or on upgrade scripts. The newest worked upgrade is `docs/plans/prosjektveiviseren-v6.md` ("Den avgjørende mekanikken", "K. Oppgraderingssti").

## Map

| What | Source | Reaches the tenant as |
|---|---|---|
| Hub site columns, content types, lists with seed rows, pages, navigation, custom actions | `Templates/Portfolio/Portfolio.xml` includes `Objects/*.xml`; columns, content types, lists and pages are one file each, listed by `xi:include` in `Objects/<Kind>/@.xml` (`href` relative to `Templates/Portfolio`) | `Portfolio.pnp` |
| Hub texts | `{resource:Key}` from `Templates/Portfolio/Resources.no-NB.resx` / `Resources.en-US.resx`, picked by the site LCID (1044, 1033) | inside the `.pnp` |
| Project, program and parent templates | `Templates/JsonTemplates/_JsonTemplate{Project,Program,Parent}.json`, sp-js-provisioning schema: `{{Key}}` = resx text, `{{ControlId_<alias>}}` = component id, `{version}` = root `package.json` | generated (gitignored) to `Templates/Content/Portfolio_content.<lng>/ProjectTemplates/*.txt` (`Standardmal`, `Programmal`, `Overordnet`; `DefaultTemplate`, ...) and uploaded to the hub's project templates library by the content template |
| Per-language content: those `.txt`, matrix configurations, `Malbibliotek`, the v6 `Fasesjekkliste` and `Planneroppgaver` rows | `Templates/Content/Portfolio_content.<lng>/Portfolio_content.<lng>.xml`, written per language, no tokens | `Portfolio_content.<lng>.pnp` |
| Term sets | `Templates/Taxonomy/Taxonomy.xml`; for existing tenants `Templates/Upgrade/<version>/<version>.xml` | `Taxonomy.pnp`, `<version>.pnp` |
| Site design `Prosjektområde` / `Project Site` | `SiteScripts/src/NNNNNN - <Title>.txt` (`Install.ps1` cuts the 9-character prefix off the title) | site scripts and design |
| Managed property mappings | `Install/SearchConfiguration.xml` | `Set-PnPSearchConfiguration -Scope Subscription` |

`Install/Build-Release.ps1` packs `Templates/Portfolio`, every folder under `Templates/Content/` (after `npm run generate-project-templates`) and `Templates/Upgrade/`, and `Templates/Taxonomy` with `Convert-PnPFolderToSiteTemplate`.

## How content reaches sites

The hub, through `Install/Install.ps1`:
- Fresh install: `Taxonomy.pnp`, then `Portfolio.pnp` and the content template with all handlers, the search configuration, `Scripts/PostInstall.ps1`.
- `-Upgrade`: `Scripts/PreInstallUpgrade.ps1` (before the apps), `Portfolio.pnp` with `-ExcludeHandlers Navigation, SupportedUILanguages, Files` (the `-UpgradeExcludeHandlers` default), the content template with `-Handlers Files` only (its rows are not applied), the search configuration, `PostInstall.ps1`, `Scripts/PostInstallUpgrade.ps1`. `Taxonomy.pnp` is never applied on upgrade. `-SkipTemplate` (an `[apps-only]` run) skips the templates, but the pre- and post-install scripts still run.
- Seed rows: `<pnp:DataRows KeyColumn="..." UpdateBehavior="...">`. `Skip` (most lists: `Prosjektkolonner` on `GtInternalName`, `Globale innstillinger` on `GtSettingsId`, `Statusseksjoner`, `Listeinnhold`, `Portefoljevisninger`, `Prosjektkolonnekonfigurasjon` on `Title`) adds the rows whose key is missing and never changes an existing row. `Overwrite` (`Maloppsett`, `Hjelpeinnhold`, `Prosjektadministrasjonstilganger`, `Idekonfigurasjon`, `Tillatelseskonfigurasjon`) rewrites its rows on every upgrade.
- On a fresh install a seed row's item id is its position in `DataRows`, and seed lookups use those ids: `Portefoljevisninger` (`GtPortfolioColumns`, `GtPortfolioRefiners`) and `Prosjektkolonnekonfigurasjon` (`GtPortfolioColumn`) point at `Prosjektkolonner` rows, `Maloppsett` (`GtProjectTemplate`) at the template files. Existing hubs have other ids, so `PostInstall.ps1` resolves such lookups at run time (by `GtInternalName` for the v6 status colours, by file name for `Maloppsett`).
- Hub pages carry `Overwrite="false"` except `Idemodul.xml` and `Konfigurasjon.xml`, so other existing pages stay as they are. Navigation is excluded on upgrade; new nodes are added in `PostInstallUpgrade.ps1` (`Add-PnPNavigationNode`).

A project site, once, at creation:
- The hub's default site design runs the site scripts; `002000 - Setup extension.txt` attaches the `ProjectSetup` customizer with default `termSetIds`.
- The wizard runs the tasks in `ProjectExtensions/src/extensions/projectSetup/tasks/index.ts`, in this order:
  - `PreTask` loads the template file linked from the chosen `Maloppsett` row; `ProjectTemplate.getSchema()` fills `Parameters` from that row (content types, column groups, phase term set), falling back to the file's values. Unless the `forceTemplate` property is set, the wizard fails when a `0x…` parameter is not a hub content type or the `GtProjectPhase` term set is missing. A catalog (cloud) template takes its schema from `CloudTemplatePackage.fromUrl`, falls back to the standard schema when the package has no `Parameters`, and is not validated.
  - `SitePermissions`.
  - `SetupProjectInformation`: `PortalDataService.syncList` builds the local properties list (`Lists_ProjectProperties_Title`: `Prosjektegenskaper`, en-US `ProjectProperties`) from the hub content type `Parameters.ProjectContentTypeId`, and the project is added to the hub list `Prosjekter`.
  - `ProvisionSiteFields` copies the hub site columns of group `Parameters.ProvisionSiteFields` ("Kolonner for Prosjektportalen (Prosjekt)"), except Calculated ones and those already there.
  - `ApplyTemplate`: `new WebProvisioner(web).setup(...).applyTemplate(schema)`, then each chosen extension without its `Hooks`. A menu (`QuickLaunch`, `TopNavigationBar`) a chosen extension declares is left out of the template (`_omitNavigationOfExtensions`), so the extension's is the one the project gets. The engine's Warning and Error lines go to the step's advanced log (`captureEngineLog`); a step that logged errors completes as `warning` («fullført med advarsler»), the last dialog warns with the count and the hub log lists the errors instead of the success line.
  - `SetTaxonomyFields` binds `Parameters.TermSetIds`; `CopyListData` copies the chosen `Listeinnhold` configurations (list rows, Planner tasks; a cloud template's bundled rows); `CustomActions`; `Hooks`.
- Nothing re-applies a template to an existing project except an admin running the wizard again (Prosjektinformasjon, "Kjør oppsettveiviser", or "Gjør om til overordnet prosjekt"). Otherwise existing projects change only through `syncList` or `Install/Scripts/UpgradeAllSitesToLatest/*.ps1`. The `ProjectUpgrade` customizer the templates add is an empty placeholder.
- What a re-run does since sp-js-provisioning 1.5.0 (`js-provisjoneringsmal.md`, «Når veiviseren kjøres på nytt»; do not assume 1.4.0's delete and recreate):
  - Existing list `Fields` and site columns are updated in place and keep their values (1.4.0 deleted and recreated list fields, which emptied the standard templates' lookup columns). A widening type change (Text to Note, Lookup to LookupMulti, User to UserMulti) is applied; another type change is a Warning that keeps the stored type. A lookup or term set pointed elsewhere follows the template only when the list (or site column) was made in that run; otherwise it is a Warning that keeps the stored target. A site column is written only when the merge changes it; a declared `CHOICES`, `Default` or `Formula` still replaces the stored one.
  - An existing list gets only the settings the template states. `RemoveExistingContentTypes` and `RemoveExistingViews` act only on lists made in that run (the extensions count) and do nothing on a list that existed.
  - The Quick Launch is reconciled by title, level by level: a kept node keeps its id, URL and audiences and is not written; nodes the template lacks are deleted by the engine, owner links included. Titles match only in the UI language of the account running the wizard (SharePoint's `Hjem` and `Dokumenter` match a Norwegian-UI account only). An existing node's URL changes only with `IgnoreExisting`.
  - The setup then puts the owners' links back (`_restoreQuickLaunch` in `projectSetup/index.ts`, only with `forceTemplate`: «Kjør oppsettveiviser» sets `__SELECT_TEMPLATE__`, «Gjør om til overordnet prosjekt» the parent template). ProjectWebParts saves the menu before the reload (`saveNavigationNodes`, local storage `pp_navigationNodes`, with the web URL). When it cannot read or store the menu, it removes an earlier save and returns `false`, and both dialogs say the owners' links will not come back, with «Fortsett likevel» and «Avbryt»; their spinner shows from the first click, so a second click adds no second custom action. A saved node the menu lacks at its level (by title) is added at the end of the level, with a new id and no audiences, unless it is the template's own (`TemplateQuickLaunch` in `projectSetup/templateQuickLaunch.ts`, fed by `ApplyTemplate`'s `declaredQuickLaunch`): the template's schema (before an extension's menu replaced it) or a chosen extension declares its title at that level or its URL (compared as the engine does), or it has a title of an earlier template version whose new title the level declares (`Gevinstoversikt` where the level has `Nytteoversikt`; on an en-US project from 1.11 or older the Norwegian titles the en-US templates had then, `Hjem` where the level has `Home`; the list, per template and level, is in that file, the new titles from `SharedResources`). Such a node stays out with its children, owners' links under it included; under a node the menu has, the saved children come back by the same rule. A node SharePoint refuses is logged and skipped. The parent template declares only `Underordnet innhold`, so a promotion brings the rest of the project's menu back.
  - A failing site column, list field, view, content type binding or data row is logged as an Error naming it, and the template goes on. A node SharePoint refuses (a URL to a page or list that does not exist) still stops the template, but leaves the menu as it was and names the node and URL.

## Typical task: a new project property in Prosjektinformasjon, editable in its panel

1. Column: `Templates/Portfolio/Objects/SiteFields/ProjectInformation/GtXxx.xml`, one `<Field>` modelled on its Text sibling `ProjectInformation/GtArchiveReference.xml`: new `ID` GUID, `Name` = `StaticName` = `GtXxx`, `DisplayName="{resource:SiteFields_GtXxx_DisplayName}"`, `Description="{resource:SiteFields_GtXxx_Description}"`, `Group="{resource:SiteFields_Portfolio_Group}"`. Register it in `Objects/SiteFields/@.xml`. With `SiteFields_Project_Group` instead it is also copied as a site column to every new project (`GtProjectPhase`, `GtStartDate`). Choices are `{resource:Choice_GtXxx_<Value>}` (`SiteFields/GtProjectLifecycleStatus.xml`).
2. Content type: `<pnp:FieldRef ID="<GUID without braces>" Name="GtXxx" UpdateChildren="true" />` in `Objects/ContentTypes/Prosjekt.xml` (`0x0100805E9E4FEAAB4F0EABAB2600D30DB70C`).
   - `UpdateChildren` pushes it into the lists that bind the type: hub `Prosjekter` and the idea module's `Lists/Idea/Prosjektdata.xml` (add it to their `AllItems` views only if wanted).
   - A taxonomy property also needs a `GtXxxText` companion there (Text or Note, `ShowInEditForm="FALSE"`): the hub sync writes only the term text, into that field (`GtProjectServiceArea`, `GtProjectServiceAreaText`).
3. Display: a `<pnp:DataRow>` in `Objects/Lists/Prosjektkolonner.xml`.
   - Append it as the last row; never insert or reorder (the lookup ids above are positions).
   - Copy a sibling's values: `GtSortOrder`, `Title` = `{resource:SiteFields_GtXxx_DisplayName}`, `GtInternalName`, `GtManagedProperty`, `GtFieldDataType` (`Text`, `Note`, `Date`, `User`, `Tags`, `Currency`, `Boolean`), `GtColMinWidth`, `GtColMaxWidth`, `GtShowFieldFrontpage`, `GtShowFieldProjectStatus`, `GtShowFieldPortfolio`, `GtIsRefinable`, `GtIsGroupable`; optionally `GtFieldOverrides` (per `Maloppsett` `FieldConfigurationName` and locale; `GtProjectNumber` has a `Program` one).
   - `GtSortOrder` orders both the read view and the panel (`createProperties`): 35 puts a field between `GtProjectNumber` (30) and `GtArchiveReference` (40).
   - Without a row the field is not shown (`EditableSPField.isVisible` asks `ProjectColumn.isVisible(page)`, `page` being `Frontpage` on the front page); the row's `Title` replaces the field's display name.
4. Search: `GtManagedProperty` follows the existing rows: the crawled default `GtXxxOWSTEXT` (`OWSDATE`, `OWSMTXT`, `OWSCHCS`, `OWSCURR`, `OWSBOOL`), or `GtXxxTextOWSTEXT` for taxonomy (`OWSMTXT` when the companion is a Note), both without a search configuration change. People fields use a `RefinableStringNN` mapped in `Install/SearchConfiguration.xml` (`GtProjectManager`: `RefinableString51`, ManagedPid `1000000051`). Nothing checks that a new RefinableString is free in the tenant (`PreInstallUpgrade.ps1` only warns about 90-98, and only on upgrades from before 1.13.0): add a check or a manual step in the release notes.
5. Texts in both `.resx` files (Localization), then `cd Templates && npm run build && npm run validate-loc` and read the reports.
6. Code: none for a supported type. The panel (`shared-library` `CustomEditPanel`, `useFieldElements`) renders `Text`, `Note`, `Number`, `Currency`, `DateTime`, `Boolean`, `URL`, `Choice`, `MultiChoice`, `User`, `UserMulti`, `TaxonomyFieldType`, `TaxonomyFieldTypeMulti` and `Lookup`, and leaves out `ShowInEditForm="FALSE"`, hidden and `ReadOnly="TRUE"` fields and `GtProjectPhase`.
7. Optional, a product choice: when the web part's `fallbackVisibleFields` is non-empty, users without hub access see only those fields (it overrides `showFieldExternal`). The project and program templates list five (`GtProjectPhase`, `GtProjectOwner`, `GtProjectManager`, `GtProjectType`, `GtProjectServiceArea`); add the name in `_JsonTemplateProject.json` and `_JsonTemplateProgram.json` only if outsiders should see it.
8. Existing installations:
   - `Install.ps1 -Upgrade` gives hubs the column, the FieldRef and the row.
   - A project's properties list gets the field only when someone saves the edit panel (`useEditPropertiesPanelSubmit` runs `usePropertiesSync` with `syncList: true`; never with the web part's `skipSyncToHub`) or reruns the wizard. Until then neither the panel nor the read view shows it.
   - To give every project the field at once, add `Install/Scripts/UpgradeAllSitesToLatest/Ensure<Name>.ps1` that does what `syncList` does: list title from `Get-Resource -Name "Lists_ProjectProperties_Title"`; return when the field exists (by id or name); `$List.Fields.AddFieldAsXml(<XML with the hub ID, Name, StaticName, Type, and DisplayName = the internal name>, $false, [Microsoft.SharePoint.Client.AddFieldOptions]::AddToDefaultContentType)`, `Invoke-PnPQuery`, then `Set-PnPField -List $List -Identity <id> -Values @{ Title = (Get-Resource -Name "SiteFields_GtXxx_DisplayName") }`.
   - Model a new step on `EnsureStakeholderGroupsTaxField.ps1`: its gate, its exists check and its names from `Get-Resource` (since 1.15.0). `EnsureProjectAdminRolesField.ps1` and `EnsureFooterExtension.ps1` have no gate at all (since 1.15.0): their exists checks are cheap, and a gate left every site an earlier upgrade had skipped without the field or the footer for good. `EnsureProjectAdminRolesField.ps1` adds its field unlike `syncList` (to the list's Item-derived content types). Rules: Writing upgrade steps.
9. Release: one Norwegian line under `### Ny funksjonalitet` in the open `## x.y.z - TBA` section of `CHANGELOG.md`; `[upgrade-all-sites-to-latest]` in the commit subject when step 8 adds a script, and never `[apps-only]`.
10. Check on the test hub in the edit panel first: read mode hides empty values (`useProjectProperties` filters `!p.isEmpty`).

## Other tasks

- Column on a project list: a hub column in `SiteFields_Project_Group` and a FieldRef in the content type in `_JsonTemplateProject.json` and `_JsonTemplateProgram.json`. Calculated columns are never copied from the hub; they live in the JSON template's `SiteFields` (`GtRiskFactor`). Existing projects: an `UpgradeAllSitesToLatest` script (`EnsureGtTagSiteColumn.ps1`).
- Porteføljeoversikt column: a view shows a `Prosjektkolonner` row only when the row's id is in the view's `GtPortfolioColumns` and `GtShowFieldPortfolio` is true (`PortfolioOverviewView.configure`). New hubs: add the fresh-install id to the `Portefoljevisninger` rows. Existing hubs: a `PostInstallUpgrade.ps1` step that finds the column by `GtInternalName`.
- Hub list: `Objects/Lists/<Name>.xml` with `Title="{resource:Lists_<X>_Title}"` and `Url="{resource:Lists_<X>_Url}"`, listed in `Objects/Lists/@.xml`. Code opens hub lists by title from `SharedResources` (`PortalDataServiceDefaultConfiguration.listNames`, `getByTitle`), and `ContentConfig` finds `Listeinnhold` sources and targets by title: a changed list title is a breaking change.
- Hub list permissions (`maler.md`, «Rettigheter på hubens lister»): end the list with an `xi:include` of `Lists/Security/MinimumReadSecurity.xml` when projects read it as configuration (owners Full Control, members and visitors Read, the group `Minimum lesetilganger på hub` Read), `Lists/Security/MinimumReadCopySecurity.xml` for such a list that inherited the hub's roles until 1.15.0 (`Lenker`, `Tidslinjekonfigurasjon`: roles copied, the group Read, so nobody loses access on the upgrade), `Lists/Security/DefaultSecurity.xml` for configuration only the hub uses (also `Installasjonslogg`, whose entries hold the install command line and trace), or nothing when users write to it or it holds data about all projects (`Prosjekter`, `Prosjektstatus`, `Tidslinjeinnhold`, `Arkiveringslogg`, which keeps every entry readable so a project sees what others archived). `Logg` alone has `Lists/Security/LogSecurity.xml` (roles copied from the hub, the group Contribute) with `ReadSecurity`/`WriteSecurity` 2 and `NoCrawl`, which `PostInstall.ps1` also sets on hubs upgraded with `-SkipTemplate`: only those who can manage lists on the hub (owners, members with Edit) read others' entries. That group has no role on the hub itself and never gets a list with data about all projects by default; `PostInstall.ps1` gives it the folder `SiteAssets/Konfigurasjon`. `MinimumReadSecurity.xml` or `DefaultSecurity.xml` on a list that inherited breaks the inheritance without copying on the next upgrade, which drops customers' own access: use the copy variant, and say under `### Merk` that the list no longer inherits. The code reads hub access per list: `PortalDataService.isAvailable` turns false only when the hub URL cannot be found or `Globale innstillinger` is denied, and another denied list only fails `isListAvailable(<list>)`. The uncached check of `Globale innstillinger` runs only on a site other than the hub, and `isUnauthorizedError` decides by the status code when the error has one (a GUID or title with 403 in it is no refusal).
- Page: on the hub `Objects/ClientSidePages/<Page>.xml` (existing hubs keep their copy unless `Overwrite="true"`); on projects the JSON templates' `ClientSidePages` (new projects; existing ones: `EnsureProjectTimelinePage.ps1`).
- Global setting: a row in `Objects/Lists/Globale innstillinger.xml` with a new `GtSettingsId` GUID, a resx `Title`, `GtSettingsKey`, `GtSettingsValue`, `GtSettingsEnabled` and `GtSettingsCategory`. `PortalDataService.getGlobalSettings()` maps key to value for enabled rows only: a disabled setting is absent, not false. A new default for an existing row needs a `PostInstallUpgrade.ps1` step (`AvailableProgramHubs`). A new row whose default must respect a state the template overwrites needs a step before the template instead: `UsageStatisticsLevel` (usage statistics, 0 to 3, seeded `2`) is added by `Initialize-UsageStatisticsSetting` (`Install/Scripts/SharedFunctions.ps1`) at the end of `PreInstallUpgrade.ps1`, on every upgrade and under `-SkipTemplate` too, because the template's Skip re-adds a deleted `CatalogTelemetryEnabled` row as `1` and the opt-out would be lost; it never changes an existing row, and `Install.ps1 -UsageStatisticsLevel` writes an explicit level right after the Portfolio template (`.development-guide/spfx/bruksstatistikk.md`, «Installasjon og oppgradering»). `AvailableProgramHubs` names the hubs the program administration reads projects from (absolute URLs, `;`-separated); the template seeds the hub's own, the upgrade step keeps it, and the code falls back to the program's own hub when the row is empty or disabled (2026-10-22).
- Terms: `Taxonomy.xml` for new tenants; for existing ones a new `Templates/Upgrade/<version>/<version>.xml` (`TermGroups` only, like 1.8.1 to 1.14.0), applied by `ApplyUpgradeTemplate "<version>"` behind a version gate in `PreInstallUpgrade.ps1`.
- v6 phase checklist and Planner task rows: edited by hand in both content XMLs (sources `docs/prosjektveiviseren-v6/innhold-*.csv`), with the same rows and `GtSortOrder` in both languages and `GtProjectPhase` as `Name|GUID` from `Taxonomy.xml`. Existing hubs never get new rows: the upgrade applies the content template with `Files` only, and `PostInstallUpgrade.ps1` fills a v6 list only while it is empty.
- New template type: `Templates/.tasks/generate-project-templates.js` maps only `Project`, `Program` and `Parent` in `templateNames` (another `_JsonTemplate<X>.json` is written as `undefined.txt`). It also needs `pnp:File` entries in both content XMLs, a `Maloppsett` row, `Lists_TemplateOptions_*` keys and an entry in `$TemplateFilesMap` in `PostInstall.ps1`.
- Template catalog (`.pppkg`): design in `docs/plans/template-catalog.md`; the hub import is `PortfolioExtensions/src/services/PackageInstaller.ts` (`provisionCloudTemplateHubDependencies` for Mode B); the wizard side is the cloud branches of `PreTask` and `CopyListData`. An import, update or cloud publish re-applies the hub template with the re-run rules above: unchanged site columns are not rewritten, what a hub admin added that the package does not state survives, existing list fields are merged and never deleted, `RemoveExistingContentTypes` does nothing on an existing hub list, a list entry without `Description` no longer empties the hub list's, and a column that fails is an Error line instead of aborting the import. `PackageInstaller` collects those Error lines (`collectErrors`): an import or update with any ends as a warning with the count and the lines in the advanced log, and a cloud publish lists them. The compatibility check (`CompatibilityService`) reports conflicts as 1.5.0 handles them (a widening type change applied, another kept with a Warning) and no longer blocks or strips existing list fields.
- Site script: reaches only sites created afterwards; `SiteScripts/src/README.md` shows `Invoke-PnPSiteDesign` for one existing site.

## Writing upgrade steps

- `PreInstallUpgrade.ps1` and `PostInstallUpgrade.ps1` read `$PreviousVersion` from the newest `Installasjonslogg` entry and gate on `$PreviousVersion -lt [version]"x.y.z"`. An `[apps-only]` upgrade logs the new version too, so a step that needs the templates checks `$SkipTemplate` and the state as well (`$V6SplitPending`, an empty v6 list), not only the version.
- x.y.z is the open `## x.y.z - TBA` heading in `CHANGELOG.md`, not the root `package.json`: that keeps the last release (1.14.0) until the release, and a gate on it skips every site upgraded from that release. Every build stamps the `package.json` version into the log, so until the bump each upgrade (every CI test-channel run too) logs 1.14.0 and a `-lt 1.15.0` step reruns: idempotence is required.
- `Scripts/UpgradeAllSitesToLatest.ps1 -Url <hub>` runs after the hub upgrade and dot-sources every `UpgradeAllSitesToLatest/*.ps1` into one scope per site (set every variable before reading it), on each group site of the hub that has the project properties list, found by `Get-Resource -Name "Lists_ProjectProperties_Title"` (`Prosjektegenskaper`, en-US `ProjectProperties`; the URL follows the title, so it differs too). CI runs it only with `[upgrade-all-sites-to-latest]` in the commit subject. Signed in with a certificate (CI) it grants no owner access, since SharePoint refuses to make the app an owner and the app reaches every site anyway; a signed-in user is still offered owner access. In CI a failure exits 1.
- Until 1.15.0 that title was hard-coded in Norwegian, so English installations ran no per-site step. The steps written before then still hard-code Norwegian names (`Prosjektegenskaper`, `Prosjektleveranser`, `Ressursallokering`, `Interessentregister`, `Prosjekttidslinje`, `Hjelpeinnhold`). On an English site their list lookups find nothing, so `EnsureStakeholderGroupsTaxField.ps1` (gate 1.14.0) never migrated an English stakeholder list until 1.15.0, when it took its names from the resources; the timeline page step would add Norwegian content, but its gate (1.8.2) stays shut on English hubs (English came in 1.12.0); the footer and project admin roles steps run ungated since 1.15.0 and add nothing language-specific (the footer's properties are `{}`, the field's names come from `Get-Resource`). A hub whose log holds one install entry gets 0.0.0 as the previous version from `Get-PPInstallationInfo`; since 1.15.0 `UpgradeAllSitesToLatest.ps1` then takes the installed version as the previous one and runs no step, the sites being as new as the installation.
- Per-site scripts gate on `$global:__PreviousVersion` (the second-newest install entry): `if ($global:__PreviousVersion -ge [version]"x.y.z") { return }`.
- A per-site step catches its own errors and logs them (`[ERROR]`, Yellow): a throw ends the run for every site after it. It never deletes values. SharePoint keeps the stored item ids when a lookup's `List` is changed (sp-js-provisioning's `docs/specs/lists-re-apply.md` probe), so they then name other items: re-point a lookup only while no item has a value, and otherwise leave it with a warning. Model: `EnsureProgramProjectLogProductLookup.ps1` (ungated; program sites by `GtIsProgram` on the properties item; adds `GtProjectLogProductLookup` to `Prosjektlogg` against `Programleveranser`, which programs from before 1.15.0 lack, and re-points it from a missing list or `Prosjektleveranser`). Its branches were checked offline against stand-ins for the PnP cmdlets, and `integration/tests/template.test.ts` reads the result on `INTEGRATION_PROGRAM_URL`. The repository has no harness for the PnP cmdlets; a pure function in `Install/Scripts/SharedFunctions.ps1` is tested from `.tasks/*.test.js` in pwsh over a JSON table of scenarios, as `.tasks/usage-statistics-level.test.js` does (`npm run test:tasks`, skipped where pwsh is missing).
- Make each step idempotent. Rename only from known default titles (`RetitleRows`, `EnsureV6BenefitTerminology.ps1`); never touch customers' own rows or names. Take localized names from `Get-Resource -Name <Key>` (the release's `Resources.<lng>.resx`): an unknown key calls `Write-Error`, which ends the script under `$ErrorActionPreference = "Stop"`.

## Localization

- Both `.resx` files carry the same keys in the same order on the same lines, mostly alphabetical: insert a new key by hand next to its alphabetical neighbour in both. `assets/scripts/Add-ResxEntry.ps1` prompts with `Read-Host`, appends at the end and re-serializes the whole file, so an agent cannot use it.
- Names: `SiteFields_<Name>_DisplayName` / `_Description`, `ContentTypes_<X>_Name`, `Lists_<X>_Title` / `_Url`, `Choice_<Field>_<Value>`, `View_<X>_DisplayName`, `ClientSidePages_<X>_PageName` / `_Title`, `Navigation_<X>_Title` / `_Url`, `WebParts_<X>_Title`.
- One key serves four readers: `{resource:Key}` in `Templates/Portfolio`, `{{Key}}` in the JSON templates (through `Templates/Resources.json`), `Get-Resource` in `Install/Scripts`, and `import resource from 'SharedResources'` in code (`src/loc/shared/{nb-no,en-us}.js` and `shared.d.ts` in all six solutions). Names that code and templates must agree on share one key. Choice values are stored as the localized text, so code compares with `resource.Choice_<Field>_<Value>` (`fetchProjectStatusReportData.ts`).
- `npm run build` in `Templates/` runs `generate-resx-json`, `generate-resx-ts` and `generate-project-templates`. No Rush dependency orders `pp365-templates` before the solutions, so run it after every resx change. Keep values non-empty and on one line: `generate-resx-ts.js` drops empty values from that language's bundle and escapes nothing but `"`.
- `npm run validate-loc` in `Templates/` exits 0 even with gaps; read the reports: `resx-ts-report.json` (keys missing from a bundle), `pnp-missing-resource-tokens-report.json` (`{resource:}` tokens a language lacks), and `<template>-validation.md` beside each generated `.txt` (unresolved `{{...}}`, such as a `ControlId_` missing from the channel file).
- The `-validation.md` files are tracked, and every run rewrites their timestamp line: revert them unless the template content changed.

## Channels and component ids

- PnP XML and site scripts hold the `main` component GUIDs; the JSON templates use `{{ControlId_<alias>}}`. A channel build swaps both from `channels/<name>.json` (`generate-pnp-templates`, `generate-site-scripts` and `generate-project-templates` read `.current-channel-config.json`).
- `Build-Release.ps1 -Channel` also puts `.current-channel-config.json` in the package's root, and `Scripts/UpgradeAllSitesToLatest.ps1` takes its channel from it (`EnsureFooterExtension.ps1`, `EnsureRiskActionPlanner.ps1`); without it, the script upgrades every site with the `main` ids and its log says so. It is a dotfile, which `actions/upload-artifact` leaves out by default: every `release-package*` upload needs `include-hidden-files: true` (missing until 2026-11-05, so every CI all-sites run on the test hub upgraded as main). `Install.ps1` has its channel baked in (`{CHANNEL_PLACEHOLDER}`) and needs no file.
- A component id hard-coded in TypeScript is not swapped: `PROJECT_SETUP_COMPONENT_ID` (`ProjectWebParts/src/components/ProjectInformation/projectSetupComponentId.ts`), the `main` id of `ProjectSetup` that `RunProjectSetupDialog` and `CreateParentDialog` add as a custom action in every language. On another channel they start the `main` channel's setup, or none when `main` is not installed (seen on the test hub 2026-11-11: the bundle came from the main package). Until 1.15.0 a site not in Norwegian got the `i18n` channel's id, which nothing installs, so the setup never started there.
- After adding an SPFx component: `npm run generate-channel-config` (refreshes `main.json` from the manifests), then `npm run generate-channel-config <name> /update` for `test`, `kurs` and `i18n`; without `/update` every id is regenerated.
- A component missing from a channel file under its own solution gets no id in that channel's build (`modifySolutionFiles.js` sets `id` to `undefined`), and `generate-pnp-templates.js` swaps nothing for it. `channels/$schema.json` requires each component under its solution; check a channel file against it after a hand edit (`kurs.json` had `DynamicListWebPart` under `PortfolioWebParts` from 1.13.0 to 1.15.0).
- `Install.ps1 -Upgrade` refuses a site installed with another channel or language. Channel builds and CI: pp365-release.

## Testing a provisioning change

- CI: `ci-channel-test.yml` upgrades the test channel's hub; `ci-releases.yml` (`releases/1.15`, `main`) upgrades the dev hub and, with `[fresh-install]` (opt-in since 2026-10-14), installs a fresh hub (no apps, site design, taxonomy or search configuration). Both filter on `SharePointFramework/`, `Install/` and `Templates/` (the test channel on `e2e/` too): a push touching only `SiteScripts/`, `channels/` or the root `.tasks/` deploys nothing (`ci-build-debug.yml` starts on every push but builds only with `[build-debug]`).
- Engine: `sp-js-provisioning` is its own repository (github.com/Puzzlepart/sp-js-provisioning), pinned at `1.5.1` in `ProjectExtensions` (the setup tasks) and `PortfolioExtensions` (`PackageInstaller.ts`). Bump: the exact version in both `package.json`, `npm run rush:update`, then `npm run generate-sbom` (pp365-toolchain).
- Local runner, in a checkout of that repository (Node from its `.nvmrc`): `npm run provision -- --package <folder|.pppkg|template.json> [--site <url>] [--lang en-US] [--mode hub|cloud] [--handlers <csv>] [--parameters k=v,...] [--skip-taxonomy] [--twice] [--strict] [--dry-run]` applies a template to a real site from Node (`debug/README.md`, the `spjs-provision` skill there). It signs in from its `.env` (`.env.example`): locally with the session cookies of this repo's e2e user (`e2e/.auth/user.json`, renewed with `npx playwright test --project=setup` in `e2e/`), in CI with an app certificate; there is no client-secret option. `--site` defaults to `INTEGRATION_SITE_URL` and must be that site or a web below it, unless `--allow-site` repeats the URL. `--twice` applies twice to show what a re-run does, `--strict` exits 1 when a handler logged an error and carried on, `--dry-run` prints the plan without signing in.
- The handlers come from the engine's `DefaultHandlerSort`, so `Security` and `WebSettings` run too. It skips Taxonomy and ContentTypes (JSOM, browser-only), Files and PropertyBagEntries unless `--handlers` forces them; SiteFields and Lists run over REST, so list content-type bindings need the content types on the site already. It mirrors `PackageInstaller` (`--mode cloud` = `provisionCloudTemplateHubDependencies`), not the wizard; debug content types and taxonomy in the browser.

## Pitfalls

- The `Gt` prefix is functional: `ProjectDataService` reads only fields matching `substringof('Gt', InternalName)`, and `SPDataAdapterBase._getFieldsToSync` sends only `Gt` fields (and the custom column group) to the hub. `ShowInEditForm="FALSE"` marks a system field: not shown, not edited, not synced.
- The `<!-- ID: N -->` comments in `Prosjektkolonner.xml` give each row's position (its id on a fresh install); keep them right when appending. From 1.8.0 to 1.14.0 the three `GtStatusOpportunities` rows in `Prosjektkolonnekonfigurasjon.xml` looked up 54 instead of 36, so existing hubs have them on the column with id 54 (`GtProjectExtensions` on a hub installed with 1.8.0 to 1.13.x and upgraded through 1.13.0) or on none; `PostInstall.ps1` adds correct rows by `GtInternalName`, and `PostInstallUpgrade.ps1` (gate 1.15.0) recycles the old ones once the right row for the same value is there, leaving rows whose title or value was changed.
- Write `xi:include` hrefs with the file's exact case. `FasesjekklisteV6.xml` and `PlanneroppgaverV6.xml` (the files end in `v6.xml`) work only because the packed `.pnp` resolves includes without regard to case.
- `pwsh assets/scripts/Check-HardcodedAttributes.ps1 -Path <file or folder>` lists `DisplayName` and `Description` values that do not use `{resource:`.
- New wording in a `Skip` row keyed on `Title` lands as a second row on existing hubs.
- A leftover `.current-channel-config.json` at the root (an aborted channel build) makes local generation use that channel's ids: delete it.
- The extensions came from site scripts until 1.14.0 and from the JSON templates' `CustomActions` since. `Standardmal` and `Programmal` carry `ProjectUpgrade`, the template selector and the footer; `Overordnet` carries only the footer, and only since 1.15.0. A parent site made with 1.14 has none of them until `EnsureFooterExtension.ps1` adds the footer. The templates get the channel's footer through `{{ControlId_Footer}}`. A site that holds two channels' footers runs both: the test hub's projects got the main channel's from all-sites runs of a package without its channel file (above). Since 1.15.0 the step removes the footer of any other channel it lists in `$ChannelFooterIds`, but only when the package names its channel: run as main, it removed the test channel's footer from 42 projects (2026-11-05). Without the file it adds the main channel's footer only to a site with no channel's footer, and removes none. `.tasks/check-channel-ids.js` fails the release build when `$ChannelFooterIds` and `channels/*.json` differ, so a new channel goes into both.

## Do not

- Do not edit generated files: `Templates/Content/**/ProjectTemplates/*.txt`, `Templates/Resources.json`, `SharePointFramework/**/src/loc/shared/*`, `.dist/`, `.channel-replace-map.json`.
- Do not change a shipped internal name, field id, content type id or list URL; change display texts through the resx and a guarded upgrade step.
- Do not insert or reorder seed rows that other rows look up; append.
- Do not put a GUID where a JSON template expects `{{ControlId_<alias>}}`, or a `ControlId_` token in PnP XML.
- Do not add a key to one `.resx` only, or reuse a key for a different text.
- Do not rerun `generate-channel-config` for an existing channel without `/update`.
- Do not use `[apps-only]` for any change under `Templates/`: `.resx`, JSON template and content changes ship only in a full run.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in documentation →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.