I was wondering what techniques there are to get a chunk of html / js injected onto each and every page in 365? Here’s the solutions that come to my mind :
- Add the snippet onto all the master pages.
- Add a web part (containing the snippet) onto each and every page.
- Feature with custom action (Not tested!)
Any other tricks or techniques?
In addition to getting code working on SharePoint Online, what about Outlook, Yammer and the other Office apps ?
argh sorry, answer already given by others but didn’t read “comment section appears first”
Why not a scriptlink with usercustomaction? you dont need to add a Feature from Solution just add by code.
i have a lot of code examples talking about that.
Chaps – what about getting code to run on the other apps (e.g. Outlook, Yammer), what’s the approach there?
Absolutely, custom action with JS registration does the job.
As for other JS stuff, it gives some rush time as all intellectual property comes out. We usually use CSOM and remote code based provision on top of SPMeta2 library –Â https://github.com/SubPointSolutions/spmeta2
I wrote about that here –Â http://sharepoint-community.net/profiles/blogs/sharepoint-artifacts-provision-part-2-meet-spmeta2-library
Hi Bala,
Take a look at Chris O’Briens session from lessons learned in sp24. One of the teams at content and code made a nice site manager purely from JS.
Here’s a link to his session :Â https://www.sp24conf.com/2014-1/Conf/SP24S108/ConfPages/SessionRoom.aspx
As for Marks question, the future proof* at the moment, is to use a custom action. Either ScriptBlock or ScriptLink the JS. Of course make sure you JS is properly written, for the place you want to execute it. Or you will have issues further down the line.
Hugh