Escape tokens in pnp provisioning template

%3CLINGO-SUB%20id%3D%22lingo-sub-1144823%22%20slang%3D%22en-US%22%3EEscape%20tokens%20in%20pnp%20provisioning%20template%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1144823%22%20slang%3D%22en-US%22%3E%3CP%3EWhen%20applying%20a%20provisioning%20template%20including%20a%20page%20template%2C%20a%20token%20such%20as%20%7Bsite%7D%2C%20%7Bsiteid%7D%2C%20or%20%7Bsitename%7D%20will%20get%20replaced%20with%20its%20associated%20value.%20These%20tokens%20are%20often%20useful%20to%20preserve%20as-is%20within%20the%20properties%20of%20a%20custom%20web%20part%20(see%20attachment).%3CBR%20%2F%3E%3CBR%20%2F%3EI've%20tried%20replacing%20the%20brackets%20in%20the%20token%20with%20html%20entities%2C%20but%20this%20doesn't%20preserve%20the%20tokens%20-%20this%20doesn't%20escape%20them.%3CBR%20%2F%3E%3CBR%20%2F%3EI.e.%20for%20a%20custom%20web%20part%20with%20at%20least%20one%20string%20field%2C%20url%2C%20I've%20tried%20using%26nbsp%3B%26amp%3B%23123%3BSite%26amp%3B%23125%3B%20instead%20of%20%7BSite%7D%2C%20but%20during%20provisioning%20the%20token%20is%20still%20replaced%20with%20the%20relative%20site%20uri%20(many%20parameters%20omitted%20for%20brevity)%3A%3C%2FP%3E%3CPRE%3E%3CBR%20%2F%3E%3CCANVASCONTROL%20webparttype%3D%22Custom%22%20jsoncontroldata%3D%22%7B%26amp%3Bquot%3Bproperties%26amp%3Bquot%3B%3A%20%7B%26amp%3Bquot%3Burl%26amp%3Bquot%3B%3A%26amp%3Bquot%3B%26amp%3B%23123%3BSite%26amp%3B%23125%3B%2FSitePages%2FSearch.aspx%26amp%3Bquot%3B%7D%7D%22%3E%3C%2FCANVASCONTROL%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FPRE%3E%3CP%3EIs%20there%20some%20way%20to%20escape%20a%20token%20to%20prevent%20it%20from%20being%20interpreted%20when%20applying%20the%20page%20template%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1144823%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EPnP%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Highlighted
Frequent Visitor

When applying a provisioning template including a page template, a token such as {site}, {siteid}, or {sitename} will get replaced with its associated value. These tokens are often useful to preserve as-is within the properties of a custom web part (see attachment).

I've tried replacing the brackets in the token with html entities, but this doesn't preserve the tokens - this doesn't escape them.

I.e. for a custom web part with at least one string field, url, I've tried using {Site} instead of {Site}, but during provisioning the token is still replaced with the relative site uri (many parameters omitted for brevity):


<pnp:CanvasControl WebPartType="Custom" JsonControlData="{&quot;properties&quot;: {&quot;url&quot;:&quot;&#123;Site&#125;/SitePages/Search.aspx&quot;}}"/>

Is there some way to escape a token to prevent it from being interpreted when applying the page template?

0 Replies