1

Content type hub is used in this scenario, to syndicate the content types and columns to several web applications.

I'm setting the JSLink property in a custom field definition, to load the .js file.

JSLink="~sitecollection/_catalogs/masterpage/scripts/PopulateFields.js"

Only the relative paths could be used in the JSLink property. And these tokens are available:

~site
~sitecollection
~layouts
~siteLayouts
~siteCollectionLayouts

In my case I can't upload any files to the global _layouts folder, so it means that I should place .js somewhere in site collection level and use the ~sitecollection token.

My question is how can I achieve this in case of My Sites where each personal site is separate site collection? It's not the best solution to put .js file to each personal site collection. How can I achieve this globaly?

3
  • I don't know if it works but... Can you deploy your JS to my site host and use ~sitecollection/../../JSPath/jsFile.js ?
    – Choggo
    Commented Nov 5, 2014 at 15:11
  • Choggo, thanks for suggestion but I need to use the same field with other site collections as well, not only with my sites, so I guess that your proposed path will be invalid to other sites.
    – Paulius
    Commented Nov 5, 2014 at 15:25
  • Yes, it will probably be invalid. One other alternative I can think of (I'm assuming no farm solutions due to _layouts being unavailable) is a sandbox solution to deploy the JS files and a powershell to deploy the solutions to all the sites consuming the fields. Still leaves you with a problem for new sites, sadly, Sandbox Solutions can only staple WEB features
    – Choggo
    Commented Nov 5, 2014 at 15:46

1 Answer 1

0

Perhaps the javascript-file could be stored in the ContenType Resource Folder (http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spcontenttype.resourcefolder.aspx) which should be located at http://yourdomain/yoursitecollection/_cts/yourcontenttypename/.

The ContentTypePublisher copies the document template from this folder to the consuming site collections, so maybe it copies the javascript-file as well.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.