Open pdemro opened 4 years ago
I have this exact same use case for provisioning a custom site template and would love to know best practice guidance.
How I got it to work (kind of)
My provisioning template (XML), amongst other things, creates two custom content types referring to pre-existing content types from my Content Type Hub (one inherits from Document and has optional Site Columns attached; the other from Document Set and has optional Site Columns attached) and two document libraries which it then adds those content types to. The content types in my PnP XML template use the same ID as they have in the Content Type Hub. I do this because I want the content types on my newly created site to update when the next CTH timer job occurs.
I got this working but had to remove the <pnp:FieldRefs>
from my <pnp:ContentType>
for the content type that inherits from Document Set.
This works fine for me when running from PowerShell on my machine, however when I run the same code via an Azure Automation Runbook I get weird "Object reference not set to an instance of an object" errors saying "Cannot bind argument to parameter 'List' because its null".
Category
[ ] Bug [ ] Enhancement [x] Question
Environment
[x ] Office 365 / SharePoint Online [ ] SharePoint 2016 [ ] SharePoint 2013
Expected or Desired Behavior
PnP Site Provisioning to function without error when creating sites based off of a template which uses content types from a content type hub
Observed Behavior
PnP Site provisioning does not seem to copy content types which are rooted from a content type hub. PnP Site Provisioning fails when creating Lists/List views referencing a content type which was based on a content type hub
Steps to Reproduce
Question
I am wondering if anyone here has any suggestions/advise/best practice for working with PnP Site Provisioning along-side of a content type hub. Any workaround folks here have used would be very helpful.
There is a PR #2565 which has been added to ignore content types from a hub, which is certainly an option (the PR is still being reviewed)