Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
paxvas2023 opened this issue Jan 22, 2025 · 0 comments

Comments

@paxvas2023
Copy link

paxvas2023 commented Jan 22, 2025

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" } }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant