PnP-Provisioning-Schema icon indicating copy to clipboard operation
PnP-Provisioning-Schema copied to clipboard

Add content type definition at list level

Open Ruslan-Urban opened this issue 3 years ago • 4 comments

In the current schema pnp:listInstance allows to reference content types defined at site level in the pnp:ContentTypeBindings element. There is no option to define content types at list level, which is currently supported by SharePoint, which includes adding list-level columns to such content types. sharepoint-powershell-add-field-to-list-content-type

This restricts from replicating of existing functionality during migrations. Re-defining of content types at site level doesn't work in all cases, e.g. when the content type is referencing fields defined at list level, and a field with exactly the same internal name exists in another list. The field GUIDs would also clash (see Issue #192).

It also causes errors in Get-PnpSiteTemplate.

In the following example, pay attention to the content type RFE: image

In the exported template the RFE content type 0x0120D520008CD19F86358D0F48945657A43A020469 becomes 0x0120D520 (Document Set), and the default content type becomes 0x0101 (Document) image

And, the default content type should be RFE, which is a document set, not a document. image

To overcome the limitations and address the issues, the following will be required:

  • Add pnp:ContentTypes element to pnp:ListInstance
  • Update core library to export content types defined at list level that reference fields defined at list level
  • Update core library to create content types defined at list level

Ruslan-Urban avatar Aug 15 '21 22:08 Ruslan-Urban

Related: Issue #185

Ruslan-Urban avatar Aug 15 '21 23:08 Ruslan-Urban

Uh oh. Ran into this as well. I need to add a field to a list content type, not the site content type. This seems impossible right now? cc @PaoloPia

heinrich-ulbricht avatar Feb 28 '22 15:02 heinrich-ulbricht

@Ruslan-Urban @PaoloPia @heinrich-ulbricht this still an issue right? I am trying to set default view to content type which is also document set to different default view as for document library default one. It seems in contentype schema were is line: <wpv:WelcomePageView xmlns:wpv="http://schemas.microsoft.com/office/documentsets/welcomepageview" ViewId="e5059152-5e4e-418c-8c2e-7c4094fb77e1" />

is were a way to change it via powershell during provisioning?

ValerasNarbutas avatar Jul 15 '24 20:07 ValerasNarbutas

@Ruslan-Urban @PaoloPia @heinrich-ulbricht this still an issue right? I am trying to set default view to content type which is also document set to different default view as for document library default one. It seems in contentype schema were is line: <wpv:WelcomePageView xmlns:wpv="http://schemas.microsoft.com/office/documentsets/welcomepageview" ViewId="e5059152-5e4e-418c-8c2e-7c4094fb77e1" />

is were a way to change it via powershell during provisioning?

I am trying to attempt the same. I would like a PS script to update or set the Document Set > Welcome Page View > ViewId

I tried updating the SchemaXML but it is read-only. Any help is appreciated.

MrRCG5 avatar Aug 14 '24 20:08 MrRCG5