Apply-PnPProvisiongTemplate on Modern Site Referenced content type not available in site or in templ

%3CLINGO-SUB%20id%3D%22lingo-sub-202249%22%20slang%3D%22en-US%22%3EApply-PnPProvisiongTemplate%20on%20Modern%20Site%20Referenced%20content%20type%20not%20available%20in%20site%20or%20in%20templ%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-202249%22%20slang%3D%22en-US%22%3E%3CP%3EI%20need%20to%20provision%20a%20modern%20UI%20site%20and%20apply%20a%20pnp%20template%20to%20create%20document%20libraries%2C%20security%20groups%2C%20home%20page%20etc%20in%20one%20go.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20have%20a%20XML%20PnP%20Template%20which%20creates%20a%20list%20referencing%20a%20custom%20content%20type%20from%20the%20content%20type%20hub.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20create%20a%20Classic%20Sites%20with%20New-SPOSite%20(In%20PowerShell)%20with%20parameter%20-Template%20%22STS%233%22.%20Then%20apply%20the%20PnP%20template%20with%20Apply-PnPProvisioningTemplate.%20This%20is%20successful%20and%20the%20document%20library%20is%20created%20with%20the%20content%20type.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHowever%2C%20if%20I%20create%20a%20modern%20site%20with%20New-SPOSite%20with%20parameter%20-Template%20%22STS%233%22.%20Then%20apply%20the%20same%20PnP%20template%20I%20get%20the%20following%20error.%20%E2%80%9CReferenced%20content%20type%200x0101007BD61AFCC8A643B8924AB3F7EE18260105%20not%20available%20in%20site%20or%20in%20template%E2%80%9D%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIt%20seems%20that%20the%20PnP%20Provisioning%20engine%20will%20happily%20%E2%80%98connect%E2%80%99%20with%20Content%20Types%20in%20the%20Hub%20for%20Classic%20sites%20but%20not%20Modern%20Sites.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSTRONG%3EIs%20this%20a%20bug%20with%20PnP%20Provisioning%20engine%20or%20a%20feature%20of%20Modern%20Sites%20or%20I%20have%20a%20missing%20a%20Pnp%20Template%20configuration%3F%20Is%20there%20work%20around%20other%20than%20to%20wait%20for%20the%20Modern%20site%20to%20eventually%20have%20the%20Content%20Types%20Syndicated%3F%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20have%20tried%20provisioning%20the%20custom%20content%20type%20locally%20with%20the%20same%20id%20and%20reference%20in%20the%20document%20library.%20Later%20content%20type%20becomes%20syndicated%20from%20the%20hub.%20However%2C%20the%20custom%20content%20site%20uses%20a%20taxonomy%20field%20which%20requires%20a%20note%20field%20with%20name%20of%20the%20taxonomy%20field%E2%80%99s%20guid.%20The%20syndication%20errors%20saying%20the%20note%20field%20already%20exists.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ETrace%20log%3C%2FP%3E%3CP%3EStack%20Trace%20is%20%5BOfficeDevPnP.Core%5D%20%5B0%5D%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%5BInformation%5D%20File%20ClientSiteListCTIssue.xml%20retrieved%20from%20folder%26nbsp%3B%200ms%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%3C%2FP%3E%3CP%3E%5BOfficeDevPnP.Core%5D%20%5B0%5D%20%5BInformation%5D%20File%20ClientSiteListCTIssue.xml%20retrieved%20from%20folder%26nbsp%3B%200ms%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%3C%2FP%3E%3CP%3E%5BProvisioning%5D%20%5B13%5D%20%5BDebug%5D%20Code%20execution%20scope%20started%200ms%2021292f6d-190b-4146-99c1-ec5a2139425d%3C%2FP%3E%3CP%3E%5BProvisioning%5D%20%5B13%5D%20%5BInformation%5D%20ProgressDelegate%20registered%200ms%2021292f6d-190b-4146-99c1-ec5a2139425d%3C%2FP%3E%3CP%3E%5BProvisioning%5D%20%5B13%5D%20%5BInformation%5D%20MessagesDelegate%20registered%200ms%2021292f6d-190b-4146-99c1-ec5a2139425d%3C%2FP%3E%3CP%3E%5BExtensibility%20Providers%5D%20%5B13%5D%20%5BDebug%5D%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20Code%20execution%20scope%20started%200ms%2021292f6d-190b-4146-99c1-ec5a2139425d%3C%2FP%3E%3CP%3E%5BExtensibility%20Providers%5D%20%5B13%5D%20%5BDebug%5D%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20Code%20execution%20scope%20ended%200ms%2021292f6d-190b-4146-99c1-ec5a2139425d%3C%2FP%3E%3CP%3E%5BList%20instances%5D%20%5B13%5D%20%5BDebug%5D%20Code%20execution%20scope%20started%200ms%2021292f6d-190b-4146-99c1-ec5a2139425d%3C%2FP%3E%3CP%3E%5BList%20instances%5D%20%5B13%5D%20%5BError%5D%20Referenced%20content%20type%200x0101007BD61AFCC8A643B8924AB3F7EE18260105%20not%20available%20in%20site%20or%20in%20template%201882ms%2021292f6d-190b-4146-99c1-ec5a2139425d%3C%2FP%3E%3CP%3E%5BList%20instances%5D%20%5B13%5D%20%5BDebug%5D%20Code%20execution%20scope%20ended%201882ms%2021292f6d-190b-4146-99c1-ec5a2139425d%3C%2FP%3E%3CP%3E%5BProvisioning%5D%20%5B13%5D%20%5BDebug%5D%20Code%20execution%20scope%20ended%2015183ms%2021292f6d-190b-4146-99c1-ec5a2139425d%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EMinimum%20Pnp%20Template%20definition%20to%20replicate%20problem%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3E%3CPROVISIONING%20pnp%3D%22%26quot%3B%26lt%3BA%22%20href%3D%22http%3A%2F%2Fschemas.dev.office.com%2FPnP%2F2018%2F05%2FProvisioningSchema%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3E%3CA%20href%3D%22http%3A%2F%2Fschemas.dev.office.com%2FPnP%2F2018%2F05%2FProvisioningSchema%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttp%3A%2F%2Fschemas.dev.office.com%2FPnP%2F2018%2F05%2FProvisioningSchema%3C%2FA%3E%22%26gt%3B%3C%2FPROVISIONING%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3CPREFERENCES%20author%3D%22%26quot%3BContent%22%20and%3D%22%22%20code%3D%22%22%3E%3C%2FPREFERENCES%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%20%3CTEMPLATES%20id%3D%22%26quot%3BMM-TEMPLATES%26quot%3B%22%3E%3C%2FTEMPLATES%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3CPROVISIONINGTEMPLATE%20id%3D%22%26quot%3BMM-CLIENTSITE%26quot%3B%22%20version%3D%22%26quot%3B1%26quot%3B%26lt%3B%2FP%22%3E%3C%2FPROVISIONINGTEMPLATE%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20BaseSiteTemplate%3D%22STS%233%22%3C%2FP%3E%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20DisplayName%3D%22My%20site%22%3C%2FP%3E%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20Description%3D%22A%20template%20for%20a%20my%26nbsp%3B%20site%22%3C%2FP%3E%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20Scope%3D%22RootSite%22%26gt%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3CWEBSETTINGS%3E%3C%2FWEBSETTINGS%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20NoCrawl%3D%22false%22%3C%2FP%3E%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20Title%3D%22Title%22%3C%2FP%3E%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20Description%3D%22Site%20Description%22%3C%2FP%3E%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20MasterPageUrl%3D%22%7Bmasterpagecatalog%7D%2Fseattle.master%22%3C%2FP%3E%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20WelcomePage%3D%22SitePages%2FHome.aspx%22%3C%2FP%3E%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20CustomMasterPageUrl%3D%22%7Bmasterpagecatalog%7D%2Fseattle.master%22%20%2F%26gt%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3CLISTS%3E%3C%2FLISTS%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3CLISTINSTANCE%20title%3D%22%26quot%3BCT%22%20hub%3D%22%22%20test%3D%22%22%3E%3C%2FLISTINSTANCE%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3CCONTENTTYPEBINDINGS%3E%3C%2FCONTENTTYPEBINDINGS%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3CCONTENTTYPEBINDING%20contenttypeid%3D%22%26quot%3B0x0101007BD61AFCC8A643B8924AB3F7EE18260105%26quot%3B%22%20default%3D%22%26quot%3Btrue%26quot%3B%2F%22%3E%3C%2FCONTENTTYPEBINDING%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CP%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3C%2FP%3E%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3C%2FP%3E%3CP%3E%26nbsp%3B%20%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CLINGO-SUB%20id%3D%22lingo-sub-202520%22%20slang%3D%22en-US%22%3ERe%3A%20Apply-PnPProvisiongTemplate%20on%20Modern%20Site%20Referenced%20content%20type%20not%20available%20in%20site%20or%20in%20t%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-202520%22%20slang%3D%22en-US%22%3E%3CP%3EI%20guess%20what%20you're%20already%20suggesting%20is%20indeed%20the%20case.%20Content%20Type%20syndication%20from%20the%20hub%20seems%20to%20be%20processed%20asynchronously%20for%20modern%20sites%20instead%20of%20synchronously%20for%20classic%20sites.%20This%20is%20one%20of%20the%20reasons%20provisioning%20of%20modern%20team%20sites%26nbsp%3B%20is%20so%20much%20faster%20than%20provisioning%20of%20classic%20sites.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20don't%20consider%20this%20a%20bug%20in%20the%20PnP%20Provisioning%20engine.%20My%20suggestion%20is%20to%20extract%20your%20Content%20TYpe%20and%20Field%20definitions%20(schema%20XML)%20from%20the%20hub%20and%20include%20it%20in%20your%20Provisioning%20Template%20XML%20so%20that%20you%20have%20the%20Content%20Type%20available%20while%20provisioning%20and%20you're%20able%20to%20associate%20it%20with%20your%20library.%20Eventually%20the%20Content%20Type%20will%20be%20syndicated%20from%20the%20hub%20with%20updates%20made%20(if%20any)%20after%20you%20extracted%20your%20definitions.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHope%20this%20helps!%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
Highlighted
Senior Member

I need to provision a modern UI site and apply a pnp template to create document libraries, security groups, home page etc in one go.

 

I have a XML PnP Template which creates a list referencing a custom content type from the content type hub.

 

I create a Classic Sites with New-SPOSite (In PowerShell) with parameter -Template "STS#3". Then apply the PnP template with Apply-PnPProvisioningTemplate. This is successful and the document library is created with the content type.

 

However, if I create a modern site with New-SPOSite with parameter -Template "STS#3". Then apply the same PnP template I get the following error. “Referenced content type 0x0101007BD61AFCC8A643B8924AB3F7EE18260105 not available in site or in template”

 

It seems that the PnP Provisioning engine will happily ‘connect’ with Content Types in the Hub for Classic sites but not Modern Sites.

 

Is this a bug with PnP Provisioning engine or a feature of Modern Sites or I have a missing a Pnp Template configuration? Is there work around other than to wait for the Modern site to eventually have the Content Types Syndicated?

 

I have tried provisioning the custom content type locally with the same id and reference in the document library. Later content type becomes syndicated from the hub. However, the custom content site uses a taxonomy field which requires a note field with name of the taxonomy field’s guid. The syndication errors saying the note field already exists.

 

Trace log

Stack Trace is [OfficeDevPnP.Core] [0]    [Information] File ClientSiteListCTIssue.xml retrieved from folder  0ms    

[OfficeDevPnP.Core] [0] [Information] File ClientSiteListCTIssue.xml retrieved from folder  0ms    

[Provisioning] [13] [Debug] Code execution scope started 0ms 21292f6d-190b-4146-99c1-ec5a2139425d

[Provisioning] [13] [Information] ProgressDelegate registered 0ms 21292f6d-190b-4146-99c1-ec5a2139425d

[Provisioning] [13] [Information] MessagesDelegate registered 0ms 21292f6d-190b-4146-99c1-ec5a2139425d

[Extensibility Providers] [13] [Debug]      Code execution scope started 0ms 21292f6d-190b-4146-99c1-ec5a2139425d

[Extensibility Providers] [13] [Debug]      Code execution scope ended 0ms 21292f6d-190b-4146-99c1-ec5a2139425d

[List instances] [13] [Debug] Code execution scope started 0ms 21292f6d-190b-4146-99c1-ec5a2139425d

[List instances] [13] [Error] Referenced content type 0x0101007BD61AFCC8A643B8924AB3F7EE18260105 not available in site or in template 1882ms 21292f6d-190b-4146-99c1-ec5a2139425d

[List instances] [13] [Debug] Code execution scope ended 1882ms 21292f6d-190b-4146-99c1-ec5a2139425d

[Provisioning] [13] [Debug] Code execution scope ended 15183ms 21292f6d-190b-4146-99c1-ec5a2139425d

 

Minimum Pnp Template definition to replicate problem

<?xml version="1.0"?>

<pnp:Provisioning xmlns:pnp="http://schemas.dev.office.com/PnP/2018/05/ProvisioningSchema">

    <pnp:Preferences Author="Content and Code" Version="1.0" Generator="OfficeDevPnP.Core, Version=2.18.1709.0, Culture=neutral, PublicKeyToken=3751622786b357c2"/>

 

  <pnp:Templates ID="MM-TEMPLATES">

    <pnp:ProvisioningTemplate ID="MM-CLIENTSITE" Version="1"

      BaseSiteTemplate="STS#3"

      DisplayName="My site"

      Description="A template for a my  site"

      Scope="RootSite">

 

      <pnp:WebSettings

        NoCrawl="false"

        Title="Title"

        Description="Site Description"

        MasterPageUrl="{masterpagecatalog}/seattle.master"

        WelcomePage="SitePages/Home.aspx"

        CustomMasterPageUrl="{masterpagecatalog}/seattle.master" />

 

      <pnp:Lists>

        <pnp:ListInstance Title="CT Hub Test" Url="cthubtest" OnQuickLaunch="true" TemplateType="101" ContentTypesEnabled="true" EnableVersioning="true" EnableMinorVersions="true" >

          <pnp:ContentTypeBindings>

            <pnp:ContentTypeBinding ContentTypeID="0x0101007BD61AFCC8A643B8924AB3F7EE18260105" Default="true"/>

          </pnp:ContentTypeBindings>

        </pnp:ListInstance>                              

      </pnp:Lists>

    </pnp:ProvisioningTemplate>

  </pnp:Templates>

</pnp:Provisioning>

1 Reply
Highlighted

I guess what you're already suggesting is indeed the case. Content Type syndication from the hub seems to be processed asynchronously for modern sites instead of synchronously for classic sites. This is one of the reasons provisioning of modern team sites  is so much faster than provisioning of classic sites.

 

I don't consider this a bug in the PnP Provisioning engine. My suggestion is to extract your Content TYpe and Field definitions (schema XML) from the hub and include it in your Provisioning Template XML so that you have the Content Type available while provisioning and you're able to associate it with your library. Eventually the Content Type will be syndicated from the hub with updates made (if any) after you extracted your definitions.

 

Hope this helps!