pnp / PnP-Sites-Core

Microsoft 365 Dev PnP Core component (.NET) targeted for increasing developer productivity with CSOM based solutions.
Other
416 stars 643 forks source link

Creating from template resolves jslink URL tokens #1018

Open VesaJuvonen opened 7 years ago

VesaJuvonen commented 7 years ago

From @johannes-z on December 25, 2016 3:16

System: Sharepoint Online

When creating a new subsite from a template, whereas the template has web parts with jslink in it, sharepoint automatically resolves any URL tokens used (e.g. ~sitecollection) for the newly created site. This breaks the jslink effectively because the URLs don't work if they are relatively specified (e.g. /sites/sitecol/....

Is there a way to either prevent this from happening or to change it after it has happened? Because the creation is user trigger CSOM/JSON can't be used.

Any ideas?

Copied from original issue: SharePoint/PnP#1577

jansenbe commented 7 years ago

We'll need to investigate this one.

justdevelopment commented 7 years ago

For now a good way to circumvent this issue is to use the HTML Number (~ ) instead of the tilde, the parser doesn't pick it up but once it's deployed SharePoint does replace it and the jslink works again.

However, it requires manual replacement in the XML which is not a good thing if you're doing the creation of template and site all automatically in one go. You could add a handler which does this replacing for you in specific instances, before you provision the new site, if this is an issue for you.

jansenbe commented 7 years ago

The workaround proposed by @justdevelopment does indeed work. Flagging this one as bug to build a better solution.

neilstarr commented 7 years ago

This work around doesn't appear to work. Is there another work around? I've tried different combinations of using CDATA and parameters with not luck.