PnP-Provisioning-Schema
PnP-Provisioning-Schema copied to clipboard
Unable to specify which content types are using a provisioned field in listinstance.
I hope I added this to the correct place, as I see this is more of a request to extend the schema.
Use case: Adding site columns to Site Pages library to get additional metadata on page details pane. I do not want to change the standard content types, thus I'm just adding site columns to the library. If adding via SharePoint Library settings UI, the fields are added to all content types (Site Page and Repost Page).
I am also able to choose via the UI to add the site columns to specific content types or just the library in general. I've added 4 site columns to my test site, in all four cases. See image below with "Test****Column" fields and how they are applied
If I extract this library via PnP PowerShell 1.4, I get the following custom FieldRefs in the ListInstance element:
<pnp:FieldRefs>
<pnp:FieldRef ID="9e602497-918f-4e39-9c47-375c116c5b91" Name="TestSitePageColumn" DisplayName="TestSitePageColumn" />
<pnp:FieldRef ID="c0243bb2-3d20-4a53-877e-032eb7f70151" Name="TestRepostPageColumn" DisplayName="TestRepostPageColumn" />
<pnp:FieldRef ID="c8b3b681-50d6-4a62-a84e-6e6c10dcf4f0" Name="TestAllPagesColumn" DisplayName="TestAllPagesColumn" />
</pnp:FieldRefs>
Notes:
- TestPageColumn is not extracted to FieldRefs nor Fields. I can actually see it used in in Views.
- If I apply this template to a new communication site (that already has the site columns), the columns are only applied to Site Page (default) content type. See image below.
Feature request: Make it possible to set to which content types the FieldRefs are applied in a ListInstance. E.g.
- All content types in the list/library
- Just one content type in the list/library
- Multiple content types in the list/library
Possible bug: A site column on a list that has content types enabled, but the column is not set to a content type is not extracted.
Steps to reproduce:
- Create any type of a site column on a site (or content type hub)
- Add that site column to the Site Pages -library with default settings
- You should see that the colulmn is added to both Site Page and Repost Page
- Extract the Site Pages list (and the site columns if needed) to a PnP template
- Invoke the template on a new site
- You should see that the columns are only applied to the Site Page content type