pnp / pnp/pnpframework

List Content Types are not created or inherited correctly when provisioned with Add-PnPSiteScript and Add-PnPListDesign

Open
#1,104 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

I try to create a custom List Template in my Tenant with the use of Add-PnPSiteScript and Add-PnPListDesign but the list content types do not get created or inherited correctly.

The name of my custom content type does not get reflected in the list and i have 2 content types of type Item. In the background both list content types seem to have the correct IDs and the parent association is also working. So it seems the Display name is some kind corrupt. As I also use "German" as UI language, the behavior is similar, in this case i get 2 content types: Item and Element (which is the german word for item). When i try to deploy just my content type without the Item content type I get an acceptable solution, but when I activate Content Types in the list, the name is again wrong= Item.

Steps to reproduce

  • In an first step I extract the List definition from an Site Collection with the command Get-PnPSiteScriptFromList. This is working without any problems.
  • In the next step I integrate the generated code from the last step without any modifications in my script and deploy it to my tenant without any errors. See code attached as script.

PnP-Deployment-Script-ListDesign.txt

Please provide any guidance how to get the correct names in list content types.

Further findings:

Documentation of Site Templates and Site Scripts not up to date

  • addContentType requires ID parameter when deploying otherwise the List template is not working properly

  • removeContentType is not working when I add a custom content type and want to remove the Item Content Type

Custom Column formatting with replace function cannot be deployed and results in error

  • Following Column formatting works in Sharepoint, but cannot be deployed via Site Script
  • { "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json", "elmType": "a", "txtContent": "@currentField", "attributes": { "href": "=replace([$FileRef], '/'+[$FileLeafRef],'/') + 'DispForm.aspx?ID=' + [$ID] + '&Source=' + replace([$FileRef], '/'+[$FileLeafRef],'')", "target": "_blank" } }

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 with the attached PnP-Deployment-Script-ListDesign.txt and reproduce the provisioning using Get-PnPSiteScriptFromList, Add-PnPSiteScript, and Add-PnPListDesign. Compare the deployed content type names and inheritance, removeContentType behavior, and column-formatting replacement error with the source list; done means the reported site-script behaviors work consistently.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.