Monday, November 20, 2017

Deploy JavaScript to a Site Collection or Web in Office 365 or On Premises + Dynamic Navigation Link

  • You have some JavaScript you'd like to inject into a page and want the simplest method of deploying it to all pages within a Site Collection or Web.
  • You can do this via custom master pages, but then you break any future upgrades from Microsoft
  • You can also do this via a Sandbox code solution, SharePoint Framework, or a SharePoint Add-In, but these are all overly complex for this simple task and may not work in some environments due to incorrect environment configurations
  • The simplest, fully supported way to do this is via a User Custom Action ScriptLink
  • John Liu has a nice UI tool to simplify registering your code with each site/site collection
  • The following code example injects simple Javascript into each page to add a dynamic link to the left navigation menu (quick launch)
  • I like to put these in Site Assets at the Site Collection root.  If you don't have a Site Assets library, you can create one by opening the site in SharePoint Designer and double clicking the Site Assets link.  You can also do this by enabling any feature that utilizes the Site Assets library.  Otherwise, you can use a different library that everyone can read from.
  • You will need the following 3 files.  These should be saved into the Site Assets library at the site collection root site.
 //Fixes Chrome Scrolling problem and load of ECMAScript 
 if (typeof(_spBodyOnLoadWrapper) !== 'undefined'){
 MenuLastLI = $('#zz14_RootAspMenu li:last');
<li class="static"><a class="static menu-item ms-core-listMenu-item ms-displayInline ms-navedit-linkNode" href=""><span class="additional-background ms-navedit-flyoutArrow"><span class="menu-item-text">CUSTOM LINK</span></span></a></li>
 }; });
  • Click to open John Liu's configuration page (configure-page.aspx)
  • Configure jQuery as Sequence 900 (so it loads first).  Install Site Collection.
  • Configure JSTest.js as Sequence 2000 (Loads after jQuery)
  • That's it.  The link should show on the left nav.

Tuesday, April 18, 2017

SharePoint 2016 Topology Planning

  • You are architecting an on-premises SharePoint 2016 Server Farm infrastructure deployment.
  • If this is an upgrade, make sure you know what features were depricated
  • Determine your server license requirements
  • Determine if you need a scripted install or wizard install
    • Scripted
      • Utilize AutoSPInstaller (open source project) to create reusable installation scripts for easier re-provisioning of servers for multiple environments and disaster recovery scenarios
      • More time to setup and initially more error-prone with greater possibility of misconfiguration and typos
    • Wizard
      • Simplified interface and best support from MS
      • You should document in OneNote all settings chosen so you can reproduce exactly
  • Determine if you can use MinRoles and decide which roles to use for which servers and how many servers you need
    • MinRoles provide best practice configurations, are better supported by Microsoft, and are easier to redeploy using the wizard
    • MinRoles cannot be used in certain large and specialized farm configurations
    • Decide how many servers you need based on projected load and high availability requirements
    • Decide which roles to use by reviewing them here: Technet - MinRole Planning
  • Design SharePoint server topology using the roles and number of servers decided earlier
  • Design SQL, Workflow Manager, and Office Online (previously Office Web Apps) server configurations