pnp / pnp/pnpframework

Feature: Make it possible to Update Fields, Content Types and Lists

Open
#720 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

Problem

The problem is: It is not possible to update site columns, content-types and lists using Invoke-PnPSiteTemplate

Story

I am frustrated when I want to update a site with new site columns, content types and Lists. If a site column already exist, Invoke-PnPSiteTemplate fails and stops.
Invoke-PnPSiteTemplate: A duplicate field name "TotalTasks" was found.

I can provision to a new site, but I need to apply it to an existing site due to keeping data and links for people.

I am working with ALM on Power Platform projects using SharePoint Lists as the storage.
On a DEV site, I create Lists holding the data.
I use Site Content Types (Not from the Content Type HUB). We do not want to mess up the HUB with our experiments.
And of course I use Site Columns (Fields) in the Content Types.

A User-Acceptance (UA) site is used to test the solutions by Users.
I provision the DEV site to the UA site. All fine the first time.
After a while users have been filling up the lists with their test data. And they have used a lot off effort getting the data into these lists.

After a while developing, new columns, content-types and lists must be added to the UA site.
And changes to existing Content-types, columns and list must also be applied.
This is ongoing work, so we want to implement it into Azure DevOps running PnP PowerShell.

Possible solution

I want to be able to use some kind of parameter to specify what I want to overwrite.
I also would like to have a filter for Fields, like: -FieldGroupsToInclude, similar to the parameter -ContentTypeGroups
`
$sourceTemplate = Get-PnPSiteTemplate -OutputInstance -Connection $pnpSourceConnection -Handlers Fields,ContentTypes,Lists
Invoke-PnPSiteTemplate -InputInstance $sourceTemplate -Connection $pnpTargetConnection -OverwriteHandlers ["Fields","ContentTypes","Lists"]

`

How I do it today using Set-PnPField

I have created my own scripts using PnP PowerShell cmdlets, using Get-PnPField, Get-PnPContentType and Get-PnP-List.
Then I filter them using group names so only the ones my team has created is stored in a variable.
Then I test the target Site for existing fields, content-types and lists, and I group them by "Create, Update and Delete".
Then my script can create the new ones, update the existing ones and even delete obsolete ones.

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 by tracing Invoke-PnPSiteTemplate and its Fields, ContentTypes, and Lists handlers in the PnP provisioning engine. Review how existing fields, content types, and lists are handled and how Get-PnPSiteTemplate selects handlers. Done means an existing target site can receive the requested updates without duplicate-field failures, with overwrite and field-group filtering behavior defined and covered by tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, powershell
Domain
tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.