Skip to content

List Content Type FieldRef won't be exported in template (e.g. using "Get-PnPSiteTemplate" command),so the provisioning engine won't handle list level contenttype settings #1229

@wuxiaojun514

Description

@wuxiaojun514

Problem

I found that I cannot find "list content type" info (the fieldlinks in list level CT, the order of fields, whether required/optional/hidden) in exported template via Get-PnPSiteTemplate. (I am using the latest version of PnP Powershell
You can see there is only ContentTypeBinding under 'ListInstance` .

Image

In my case, I just have one field "Title" in site level content type, and the rest fields are in the list content type level. (I need create a custom content type for search purpose)
The PnP Provisioning tool would not add those other fields to my list content type. I have to manually add them after deployment.

I read the source code of PnP Powershell, it calls some methods from PnP Framework library to export template, so I want to raise the issue here.

Expectation

It should include list content type with fieldRef info in the exported template, like this sample

 <pnp:ContentType DisplayFormClientSideComponentId="" DisplayFormClientSideComponentProperties="" NewFormClientSideComponentProperties="" EditFormClientSideComponentId="" EditFormClientSideComponentProperties="" ID="0x010080060E093E2F463EBA41A5F044428F32" Name="Search Config Content Type" Description="Designed to facilitate the storage of Search Config information." Group="Search Config" NewFormUrl="" EditFormUrl="" DisplayFormUrl="" UpdateChildren="false">
          <pnp:FieldRefs>
            <pnp:FieldRef ID="c042a256-787d-4a6f-8a8a-cf6ab767f12d" Name="ContentType" UpdateChildren="true" />
            <pnp:FieldRef ID="fa564e0f-0c70-4ab9-b863-0177e6ddd247" Name="Title" Required="true" UpdateChildren="true" />
            <pnp:FieldRef ID="d26b5f0c-27cf-46d0-984c-a0c2ea81cb10" Name="Status" UpdateChildren="true" />
            <pnp:FieldRef ID="f2630201-2b18-4f74-867b-18551759b437" Name="Scope" UpdateChildren="true" />
            <pnp:FieldRef ID="df38fc53-0740-4846-80b2-cd5c4cf6b5d7" Name="ConfigNotes" UpdateChildren="true" />
          </pnp:FieldRefs>
        </pnp:ContentType>

When we run Invoke-PnPSiteTemplate this list content type settings should be applied on the destination site


I found that ListInstance class in PnP Framework also just have content type binding, no list content type attributes under it.

Image

Probably it may need modify quite a lot code to fix it.
I will do more research on it and see if I can contribuite.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions