PnP Engine does not extract site columns and site contentype from subsite, I looked at code and ObjectField Class --> ExtractObjects Methods check for subsite and if that is case it does not extract any of them, is there a reason or it is not recommended to deploy site columns and site content type at subsite?
Hi krunal039,
this is actually by design. Following is copied from https://github.com/OfficeDev/PnP/issues/1021. We do not want to promote / support this by design in the engine. Technically you could implement support for sub site content type creation using provisioning provider, but this is not really recommended option from Microsoft engineering perspective, since that will cause you massive headache from long run perspective.
We have done intentional decision not to support site columns and content types created on the sub site level. This is due the fact that this design is NOT recommended and was never recommended in the farm solution models either.
Problem with the sub site created content types and site columns is that they do not have references on the site collection instances, which then means that you can't update site collection from one location and are forced to loop in all also all sub sites when you apply any changes on the content types and site columns... which causes additional costs and time needed for any operations.
This same challenge was there already in the farm solutions and we have always recommended to create content types and site columns using site scoped feature at site collection level and then push those to be used in the sub sites using references. This way you can push updates on the content types and site columns at the site collection level simply by referencing those in the site collection root and then push updates to children (instances in sub sites and lists).
Due above justification - will close the issue.
@VesaJuvonen : I absolutely agreed with you. As design my Microsoft we should use all Site columns and CT in site collection level that could further use for sub site levels. If we create CT at sub site level and refere some columns from the site collection then PnP Provision get / Apply template not at support and export CT from the application.
I did many test from power shell and PnP tools. This has also applicable for premises SharePoint also.
Thanks for supporting us and spreading the expected knowledge among the worlds.
By
Nitinkumar Kakulde
Technical Architech, Infosys
@VesaJuvonen I understand the intention, but what about lookup site columns which target lists created in a subsite? In this case, you have to define the lookup site column in the same site as the list, and also you need to create the content type in the same site where the site column was created, right?
Sorry for the late reply.
Most helpful comment
@VesaJuvonen I understand the intention, but what about lookup site columns which target lists created in a subsite? In this case, you have to define the lookup site column in the same site as the list, and also you need to create the content type in the same site where the site column was created, right?
Sorry for the late reply.