Modern Sites - Content Type Hub Site Policy initial sync time

%3CLINGO-SUB%20id%3D%22lingo-sub-127517%22%20slang%3D%22en-US%22%3EModern%20Sites%20-%20Content%20Type%20Hub%20Site%20Policy%20initial%20sync%20time%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-127517%22%20slang%3D%22en-US%22%3E%3CP%3EHi%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI'm%20using%20PnP%20Partner%20Pack%20to%20provision%20sites%20and%20apply%20site%20policies%20using%20the%20PnP%20Template%20XML%20(%3CSITEPOLICY%3E)%20once%20the%20site%20is%20provisioned.%20The%20site%20policies%20have%20been%20created%20in%20the%20content%20type%20hub.%20For%20classic%20sites%20this%20is%20fine%20as%20the%20content%20type%20hub%20is%20hooked%20up%20as%20soon%20as%20the%20site%20is%20ready%2C%20but%20for%20modern%20sites%20this%20is%20done%20later%20on.%20I%20was%20hoping%20I%20could%20just%20intermittently%20check%20for%20the%20policies%20being%20pulled%20down%20to%20the%20site%20and%20apply%20the%20policy%20when%20they%20are%20as%20often%20I%20was%20seeing%20this%20occur%205-10%20minutes%20after%20a%20site%20was%20created.%20But%20occasionally%20I've%20seen%20it%20take%202%20hours%2B.%3C%2FSITEPOLICY%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI'm%20guessing%20there%20is%20a%20%22worst%20case%22%20time%20given%20for%20how%20long%20this%20can%20take%20in%20SP%20Online%20a%20bit%20like%20items%20being%20found%20by%20search.%20I%20notice%20in%20%3CA%20href%3D%22https%3A%2F%2Fjoannecklein.com%2F2016%2F09%2F16%2Fspo-content-type-hub%2F%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3EJoanne%20Kleins%20blog%20post%3C%2FA%3Ethere%20is%20mention%20of%20syndication%20of%20updates%20taking%2024-48%20hours%2C%20is%20this%20the%20worst%20case%20time%20for%20initial%20hook%20up%20of%20a%20site%20to%20the%20content%20type%20hub%3F%20I've%20also%20seen%20a%20reply%20on%20stack%20exchange%20of%204%20hours%20for%20the%20Content%20Type%20Hub%20Subscriber%20Timer%20Job.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI'm%20also%20guessing%20there%20is%20currently%20no%20way%20of%20opting%20into%20this%20being%20hooked%20up%20any%20quicker.%20Clearly%20the%20classic%20sites%20wait%2C%20but%20I%20guess%20to%20speed%20up%20provisioning%20of%20modern%20they%20opt%20out%20of%20doing%20this.%20I%20know%20you%20can%20programmatically%20ask%20for%20a%20refresh%20of%20the%20CTs%20in%20the%20hub%20by%20clearing%20out%20the%20property%20bag%20property%20%22metadatatimestamp%22%20(which%20is%20the%20programmatic%20equivalent%20of%20clicking%20%22Refresh%20all%20published%20content%20types%20on%20next%20update%22)%2C%20but%20for%20my%20scenario%20it's%20the%20initial%20pull%20down%20I'm%20waiting%20on.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAny%20info%20appreciated.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EEDIT%20-%20admittedly%20this%20is%20probably%20a%20duplicate%20of%20the%20second%20question%20on%20this%20post%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2FSharePoint%2F0365-group-Content-type-publishing-hubs-unable-to-refresh-all%2Fm-p%2F75733%2Fhighlight%2Ffalse%23M7145%22%20target%3D%22_blank%22%3Ehttps%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2FSharePoint%2F0365-group-Content-type-publishing-hubs-unable-to-refresh-all%2Fm-p%2F75733%2Fhighlight%2Ffalse%23M7145%3C%2FA%3Ewhich%20received%20no%20response%20around%20sync%20time.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-786014%22%20slang%3D%22en-US%22%3ERe%3A%20Modern%20Sites%20-%20Content%20Type%20Hub%20Site%20Policy%20initial%20sync%20time%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-786014%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F3680%22%20target%3D%22_blank%22%3E%40Adam%20Wildash%3C%2FA%3E%26nbsp%3BThis%20is%20a%20known%20issue%20since%20modern%20sites%20released.%20Content%20types%20will%20not%20be%20synced%20immediately%20to%20newly%20created%20sites%20in%20modern%20sites.%20It%20takes%20anywhere%20from%2010%20mins%20to%204%20hrs%20in%20my%20observation.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EToday%2C%20we%20have%20written%20a%20script%20to%20keep%20looking%20(wait%20and%20loop%20every%2020%20minutes)%20for%20content%20types%20available%20or%20not%20in%20site%20collection%20in%20post-site-creation%20script.%20We%20are%20using%20content%20types%20from%20content%20type%20hub%2C%20as%20site%20design%20script%20provision%20all%20lists%20and%20libraries%20which%20EOD%20uses%20content%20types.%20So%2C%20once%20content%20types%20are%20available%20we%20are%20adding%20content%20types%20to%20libraries%20and%20lists.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E-Praveen.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-927079%22%20slang%3D%22en-US%22%3ERe%3A%20Modern%20Sites%20-%20Content%20Type%20Hub%20Site%20Policy%20initial%20sync%20time%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-927079%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F374922%22%20target%3D%22_blank%22%3E%40Praveen_Battula%3C%2FA%3E%26nbsp%3B%20Greetings%2C%20I%20am%20facing%20the%20same%20situation%2C%20has%20there%20been%20any%20development%20in%20being%20able%20to%20force%20a%20sync%3F%20or%20can%20you%20share%20whatever%20code%20you%20used%20to%20check%20and%20update%20when...%3F%26nbsp%3B%20thank%20you%20for%20any%20help%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-952636%22%20slang%3D%22en-US%22%3ERe%3A%20Modern%20Sites%20-%20Content%20Type%20Hub%20Site%20Policy%20initial%20sync%20time%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-952636%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F374922%22%20target%3D%22_blank%22%3E%40Praveen_Battula%3C%2FA%3E%26nbsp%3B%20Couldn't%20you%20just%20deploy%20the%20content%20types%20in%20your%20site%20design%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-953383%22%20slang%3D%22en-US%22%3ERe%3A%20Modern%20Sites%20-%20Content%20Type%20Hub%20Site%20Policy%20initial%20sync%20time%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-953383%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F8901%22%20target%3D%22_blank%22%3E%40Russell%20Gove%3C%2FA%3Eso%20I%20have%20pnp%20scripted%20the%20site%20creation%20for%20a%20new%20modern%20site...%20I%20have%20also%20scripted%20adding%20the%20content%20type%20from%20existing%20types...%20however%20it%20doesn't%20become%20and%20existing%20content%20type%20until%204-12%20hours%20after%20the%20site%20is%20created.%26nbsp%3B%20(content%20type%20doesn't%20technically%20exist)%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Eone%20would%20suppose%20I%20could%20create%20a%20new%20type%2C%20but%20in%20the%20case%20of%20ever%20editing%20it%2C%20you%20would%20want%20it%20to%20inherit%20properties%20across%20enterprise%20I%20would%20assume.%26nbsp%3B%20so%20was%20looking%20for%20w%20away%20to%20force%20the%20sync%20so%20content%20type%20is%20instantly%20available%20(or%20quickly%20available)%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Eeverything%20I%20have%20read%20this%20is%20not%20possible...%20but%20as%20time%20passes%20who%20knows.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-953951%22%20slang%3D%22en-US%22%3ERe%3A%20Modern%20Sites%20-%20Content%20Type%20Hub%20Site%20Policy%20initial%20sync%20time%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-953951%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F8901%22%20target%3D%22_blank%22%3E%40Russell%20Gove%3C%2FA%3E%26nbsp%3BI%20have%20tried%20this%20as%20option%201%20long%20time%20back.%20But%2C%20if%20you%20want%20a%20content%20type%20inheriting%20from%20content%20type%20hub%2C%20provisioning%20through%20site%20design%20have%20some%20issues.%20When%20I%20define%20a%20content%20type%2C%20site%20columns%20with%20same%20Id's%20in%20site%20design%20script%20the%20content%20types%20are%20available%20immediately.%20But%2C%20when%20I%20see%20after%20few%20hours%2C%20the%20content%20type%20publishing%20log%20shows%20errors%20when%20it%20syncs%20from%20content%20type%20hub.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20also%20using%20document%20content%20types%2C%20document%20set%20content%20types.%20Publishing%20site%20features%20is%20not%20a%20possible%20option%20in%20Site%20design.%20So%2C%20definitely%20adding%20document%20set%20content%20type%20is%20not%20a%20possible%20way%20for%20us%20via%20site%20design%20scripts%20as%20it%20depends%20on%20%22Document%20Set%22%20site%20feature.%20(Please%20try%20with%20document%2C%20document%20set%2C%20list%20content%20types%20in%20your%20sandbox%20and%20let%20us%20know).%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAlso%2C%20tried%20the%20option%202%2C%26nbsp%3B%20PnP%20provisioning%20script%20with%20just%202%20content%20types%2C%20site%20columns%2C%20one%20page%20in%20it.%20But%2C%20this%20also%20created%20problems%20when%20I%20see%20the%20content%20type%20publishing%20log%20of%20the%20site.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThen%20I%20chosen%20option%203%2C%20wrote%20azure%20Runbook%20and%20wait%20for%20the%20content%20types%20sync%20to%20newly%20created%20sites%20before%20I%20send%20email%20to%20owners%20of%20the%20site%20saying%20site%20is%20ready.%20Unfortunately%2C%20I%20observed%20in%20my%20experience%20(last%208%20months)%20average%20it%20took%20over%20an%20hour%20for%20provisioning%20content%20types%20to%20newly%20created%20sites%20(Our%20customers%20are%20now%20ok%20to%20wait%20for%20an%20hour%2C%20imagine%20in%20long%20run%20waiting%20for%20such%20a%20long%20time%20for%20a%20single%20site).%20We%20have%20a%20hard%20limit%20of%20waiting%2090%20minutes%20and%20then%20kill%20Runbook.%20So%2C%20we%20usually%20get%206-9%20sites%20fail%20messages%20to%20admins%20as%20they%20failed%20to%20get%20content%20types%20from%20content%20type%20hub%20within%2090%20minutes.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThis%20is%20so%20frustrating%20that%20this%20shouldn't%20be%20this%20complex.%20Microsoft%20doesn't%20help%20in%20some%20situations%20or%20don't%20even%20give%20some%20direction%20for%20these%20kind%20of%20issues.%20This%20is%20a%20minimal%20thing%20everyone%20needs%20that%20how%20fast%20we%20are%20able%20to%20create%20team%20sites%20is%20not%20a%20point%2C%20how%20fast%20we%20are%20creating%20a%20site%20with%20the%20correct%20structure%20we%20need%20is%20matters.%20Content%20type%20hub%20%2B%20Modern%20team%20sites%20is%20a%20disaster%20combination%20as%20of%20now.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E-Praveen.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-953973%22%20slang%3D%22en-US%22%3ERe%3A%20Modern%20Sites%20-%20Content%20Type%20Hub%20Site%20Policy%20initial%20sync%20time%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-953973%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F430952%22%20target%3D%22_blank%22%3E%40pseudo%3C%2FA%3E%26nbsp%3BPlease%20see%20my%20latest%20reply.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20have%20used%20azure%20runbook%20(pnp%20powershell)%20to%20complete%20this.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWe%20are%20using%20site%20design%20script%20for%20provisioning%20lists%2C%20libraries%2C%20add%20to%20hub%20site%20and%20deploy%20extensions%20to%20the%20newly%20created%20site.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWe%20are%20using%20Microsoft%20Flow%20to%20do%20some%20business%20logic%20on%20newly%20created%20site%20and%20then%20if%20all%20good%2C%20calling%20Azure%20Runbook%20from%20Microsoft%20flow.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIn%20Azure%20Runbook%2C%20we%20are%20checking%20content%20types%20availability.%20If%20content%20types%20are%20not%20available%20yet%2C%20then%20we%20are%20sleeping%20for%2010%20minutes%20and%20calling%20a%20recursive%20function.%20We%20are%20waiting%206%20times%20(60%20minutes)%20and%20check%20every%2010%20minutes%20availability%20of%20content%20types.%20If%20yes%2C%20then%20we%20are%20adding%20content%20types%20to%20libraries.%20Once%20all%20good%2C%20we%20are%20sending%20response%20back%20to%20Flow.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EFlow%20is%20reading%20response%20from%20Azure%20Runbook%20and%20send%20email%20to%20site%20owners%20saying%20Site%20is%20Ready.%20In%20case%20if%20the%20content%20types%20are%20not%20available%20then%20we%20are%20sending%20email%20to%20help%20desk%20to%20take%20a%20look%20at%20the%20issue%20(manually).%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EPlease%20let%20me%20know%20if%20you%20need%20any%20specific%20help%20in%20understanding%20above%20implementation.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSTRONG%3ESample%20code%20to%20understand%3A%26nbsp%3B%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Efunction%20Check-ContentTypesAvailable%20%7B%3CBR%20%2F%3E%24ctype%20%3D%20%24libraryMapping%5B0%5D.contentType.split('%2C')%3CBR%20%2F%3E%24contentType%20%3D%20Get-PnPContentType%20-Identity%20%24ctype%5B1%5D%3CBR%20%2F%3Eif(!%24contentType)%7B%3CBR%20%2F%3Eif(%24checkContentTypesAttempts%20-lt%206)%20%7B%3CBR%20%2F%3EWrite-Warning%20%22Content%20type%20is%20null%2C%20sleeping%20for%2010%20mins.%22%3CBR%20%2F%3Esleep%20600%3CBR%20%2F%3E%24checkContentTypesAttempts%2B%2B%3CBR%20%2F%3ECheck-ContentTypesAvailable%3CBR%20%2F%3E%7D%3CBR%20%2F%3Eelse%20%7B%3CBR%20%2F%3E%24global%3AerrorMessage%20%3D%20%22Made%206%20attempts.%20Still%20content%20types%20are%20not%20available.%22%3CBR%20%2F%3EWrite-Error%20%24global%3AerrorMessage%3CBR%20%2F%3E%24global%3AerrorCount%2B%2B%3CBR%20%2F%3Ereturn%3CBR%20%2F%3E%7D%3CBR%20%2F%3E%7D%3CBR%20%2F%3Eelse%7B%3CBR%20%2F%3EWrite-Verbose%20%22Content%20types%20available%22%3C%2FP%3E%3CP%3EWrite-Verbose%20%22%60t%204.2.%20Add%20content%20type%20to%20libraries%20-%20Starting.%22%3CBR%20%2F%3E%24libraryIndex%20%3D%200%3CBR%20%2F%3EForEach(%24library%20in%20%24libraryMapping)%7B%3CBR%20%2F%3E%24libraryIndex%2B%2B%3CBR%20%2F%3E%24cts%20%3D%20%24library.contentType.split('%2C')%3CBR%20%2F%3EForEach(%24ct%20in%20%24cts)%7B%3CBR%20%2F%3Etry%7B%3CBR%20%2F%3EAdd-PnPContentTypeToList%20-List%20%24library.name%20-ContentType%20%24ct%20-DefaultContentType%20%7C%20Out-Null%3CBR%20%2F%3E%7D%3CBR%20%2F%3Ecatch%7B%3CBR%20%2F%3E%24global%3AerrorCount%2B%2B%3CBR%20%2F%3E%24global%3AerrorMessage%20%3D%20%22Adding%20content%20type%20to%20%24library%20failed.%22%3CBR%20%2F%3EWrite-Error%20%24global%3AerrorMessage%3CBR%20%2F%3E%7D%3CBR%20%2F%3E%7D%3CBR%20%2F%3EWrite-Verbose%20%22%60t%20%60t%204.2.%24libraryIndex.%20Added%20content%20type%20%24library%22%3CBR%20%2F%3E%7D%3CBR%20%2F%3E%24global%3AcontentTypesAvailable%20%3D%20%24true%3CBR%20%2F%3EWrite-Verbose%20%22%60t%204.2.%20Add%20content%20type%20to%20libraries%20-%20Completed.%22%3CBR%20%2F%3E%7D%3CBR%20%2F%3E%7D%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20input%20of%20the%20librarymapping%20looks%20like%20below%3A%26nbsp%3B%3C%2FP%3E%3CP%3E%24libraryMapping%20%3D%3CBR%20%2F%3E%40(%3CBR%20%2F%3E%5Bpscustomobject%5D%40%7Bname%3D%22Lib1%22%3BcontentType%3D%22ct1%2Cct2%22%7D%2C%3CBR%20%2F%3E%5Bpscustomobject%5D%40%7Bname%3D%22Lib2%22%3BcontentType%3D%22ct3%22%7D%3CBR%20%2F%3E%5Bpscustomobject%5D%40%7Bname%3D%22Lib3%22%3BcontentType%3D%22ct4%22%7D%3CBR%20%2F%3E)%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EJust%20for%20you%2C%20composed%20this%20function%20to%20understand.%20Please%20test%20yourself%20for%20any%20syntax%20issues.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Ethanks%3C%2FP%3E%3CP%3E-Praveen.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-959044%22%20slang%3D%22en-US%22%3ERe%3A%20Modern%20Sites%20-%20Content%20Type%20Hub%20Site%20Policy%20initial%20sync%20time%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-959044%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F374922%22%20target%3D%22_blank%22%3E%40Praveen_Battula%3C%2FA%3E-%20no%20worries%2C%20I%20am%20looking%20for%20a%20sync%20for%20the%20existing%20site%20content%20types%20for%20immediate%20access.%26nbsp%3B%20I%20have%20a%20workaround%20to%20enable%20them%20after%2012%20hours.%20through%20a%20scheduled%20job%2C%20this%20is%20just%20to%20get%20request%20turned%20around%20near%20immediately.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1285561%22%20slang%3D%22en-US%22%3ERe%3A%20Modern%20Sites%20-%20Content%20Type%20Hub%20Site%20Policy%20initial%20sync%20time%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1285561%22%20slang%3D%22en-US%22%3Ejust%20a%20quick%20update%3A%20Looks%20like%20Microsoft%20is%20planning%20to%20release%20modernized%20content%20type%20gallery%2C%20term%20store%20this%20quarter.%20See%20more%20details%20here%3A%3CBR%20%2F%3E%3CBR%20%2F%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fmicrosoft-sharepoint-blog%2Fmodernizing-sharepoint-managed-metadata-services-mms%2Fba-p%2F1277450%22%20target%3D%22_blank%22%3Ehttps%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fmicrosoft-sharepoint-blog%2Fmodernizing-sharepoint-managed-metadata-services-mms%2Fba-p%2F1277450%3C%2FA%3E%3C%2FLINGO-BODY%3E
Highlighted
Occasional Contributor

Hi,

 

I'm using PnP Partner Pack to provision sites and apply site policies using the PnP Template XML (<pnp:SitePolicy>) once the site is provisioned. The site policies have been created in the content type hub. For classic sites this is fine as the content type hub is hooked up as soon as the site is ready, but for modern sites this is done later on. I was hoping I could just intermittently check for the policies being pulled down to the site and apply the policy when they are as often I was seeing this occur 5-10 minutes after a site was created. But occasionally I've seen it take 2 hours+.

 

I'm guessing there is a "worst case" time given for how long this can take in SP Online a bit like items being found by search. I notice in Joanne Kleins blog post there is mention of syndication of updates taking 24-48 hours, is this the worst case time for initial hook up of a site to the content type hub? I've also seen a reply on stack exchange of 4 hours for the Content Type Hub Subscriber Timer Job.

 

I'm also guessing there is currently no way of opting into this being hooked up any quicker. Clearly the classic sites wait, but I guess to speed up provisioning of modern they opt out of doing this. I know you can programmatically ask for a refresh of the CTs in the hub by clearing out the property bag property "metadatatimestamp" (which is the programmatic equivalent of clicking "Refresh all published content types on next update"), but for my scenario it's the initial pull down I'm waiting on.

 

Any info appreciated.

 

Thanks.

 

EDIT - admittedly this is probably a duplicate of the second question on this post https://techcommunity.microsoft.com/t5/SharePoint/0365-group-Content-type-publishing-hubs-unable-to-... which received no response around sync time.

 

 

8 Replies
Highlighted

@Adam Wildash This is a known issue since modern sites released. Content types will not be synced immediately to newly created sites in modern sites. It takes anywhere from 10 mins to 4 hrs in my observation. 

 

Today, we have written a script to keep looking (wait and loop every 20 minutes) for content types available or not in site collection in post-site-creation script. We are using content types from content type hub, as site design script provision all lists and libraries which EOD uses content types. So, once content types are available we are adding content types to libraries and lists. 

 

-Praveen.

Highlighted

@Praveen_Battula  Greetings, I am facing the same situation, has there been any development in being able to force a sync? or can you share whatever code you used to check and update when...?  thank you for any help

Highlighted

@Praveen_Battula  Couldn't you just deploy the content types in your site design?

Highlighted

@Russell Goveso I have pnp scripted the site creation for a new modern site... I have also scripted adding the content type from existing types... however it doesn't become and existing content type until 4-12 hours after the site is created.  (content type doesn't technically exist) 

 

one would suppose I could create a new type, but in the case of ever editing it, you would want it to inherit properties across enterprise I would assume.  so was looking for w away to force the sync so content type is instantly available (or quickly available)

 

everything I have read this is not possible... but as time passes who knows.

Highlighted

@Russell Gove I have tried this as option 1 long time back. But, if you want a content type inheriting from content type hub, provisioning through site design have some issues. When I define a content type, site columns with same Id's in site design script the content types are available immediately. But, when I see after few hours, the content type publishing log shows errors when it syncs from content type hub. 

 

I also using document content types, document set content types. Publishing site features is not a possible option in Site design. So, definitely adding document set content type is not a possible way for us via site design scripts as it depends on "Document Set" site feature. (Please try with document, document set, list content types in your sandbox and let us know).

 

Also, tried the option 2,  PnP provisioning script with just 2 content types, site columns, one page in it. But, this also created problems when I see the content type publishing log of the site. 

 

Then I chosen option 3, wrote azure Runbook and wait for the content types sync to newly created sites before I send email to owners of the site saying site is ready. Unfortunately, I observed in my experience (last 8 months) average it took over an hour for provisioning content types to newly created sites (Our customers are now ok to wait for an hour, imagine in long run waiting for such a long time for a single site). We have a hard limit of waiting 90 minutes and then kill Runbook. So, we usually get 6-9 sites fail messages to admins as they failed to get content types from content type hub within 90 minutes. 

 

This is so frustrating that this shouldn't be this complex. Microsoft doesn't help in some situations or don't even give some direction for these kind of issues. This is a minimal thing everyone needs that how fast we are able to create team sites is not a point, how fast we are creating a site with the correct structure we need is matters. Content type hub + Modern team sites is a disaster combination as of now. 

 

-Praveen.

Highlighted

@pseudo Please see my latest reply. 

 

I have used azure runbook (pnp powershell) to complete this. 

 

We are using site design script for provisioning lists, libraries, add to hub site and deploy extensions to the newly created site. 

 

We are using Microsoft Flow to do some business logic on newly created site and then if all good, calling Azure Runbook from Microsoft flow. 

 

In Azure Runbook, we are checking content types availability. If content types are not available yet, then we are sleeping for 10 minutes and calling a recursive function. We are waiting 6 times (60 minutes) and check every 10 minutes availability of content types. If yes, then we are adding content types to libraries. Once all good, we are sending response back to Flow. 

 

Flow is reading response from Azure Runbook and send email to site owners saying Site is Ready. In case if the content types are not available then we are sending email to help desk to take a look at the issue (manually). 

 

Please let me know if you need any specific help in understanding above implementation. 

 

Sample code to understand: 

 

function Check-ContentTypesAvailable {
$ctype = $libraryMapping[0].contentType.split(',')
$contentType = Get-PnPContentType -Identity $ctype[1]
if(!$contentType){
if($checkContentTypesAttempts -lt 6) {
Write-Warning "Content type is null, sleeping for 10 mins."
sleep 600
$checkContentTypesAttempts++
Check-ContentTypesAvailable
}
else {
$global:errorMessage = "Made 6 attempts. Still content types are not available."
Write-Error $global:errorMessage
$global:errorCount++
return
}
}
else{
Write-Verbose "Content types available"

Write-Verbose "`t 4.2. Add content type to libraries - Starting."
$libraryIndex = 0
ForEach($library in $libraryMapping){
$libraryIndex++
$cts = $library.contentType.split(',')
ForEach($ct in $cts){
try{
Add-PnPContentTypeToList -List $library.name -ContentType $ct -DefaultContentType | Out-Null
}
catch{
$global:errorCount++
$global:errorMessage = "Adding content type to $library failed."
Write-Error $global:errorMessage
}
}
Write-Verbose "`t `t 4.2.$libraryIndex. Added content type $library"
}
$global:contentTypesAvailable = $true
Write-Verbose "`t 4.2. Add content type to libraries - Completed."
}
}

 

The input of the librarymapping looks like below: 

$libraryMapping =
@(
[pscustomobject]@{name="Lib1";contentType="ct1,ct2"},
[pscustomobject]@{name="Lib2";contentType="ct3"}
[pscustomobject]@{name="Lib3";contentType="ct4"}
)

 

Just for you, composed this function to understand. Please test yourself for any syntax issues. 

 

thanks

-Praveen.

Highlighted

@Praveen_Battula- no worries, I am looking for a sync for the existing site content types for immediate access.  I have a workaround to enable them after 12 hours. through a scheduled job, this is just to get request turned around near immediately.

 

 

Highlighted
just a quick update: Looks like Microsoft is planning to release modernized content type gallery, term store this quarter. See more details here:

https://techcommunity.microsoft.com/t5/microsoft-sharepoint-blog/modernizing-sharepoint-managed-meta...