Turn Scripting Capabilities On in SharePoint Online

By default, SharePoint Online tenancies have scripting capabilities turned off, closing off a myriad of useful features such as being able to upload certain file types (.aspx, .master), being able to create custom page layouts, and even using the Content Editor and Script Editor web parts.

For more information, see: https://support.office.com/en-us/article/Turn-scripting-capabilities-on-or-off-1f2c515f-5d7e-448a-9fd7-835da935584f

We can enable scripting from the Office 365 SharePoint Admin Centre, as detailed in the link above. However, the changes are not instant and take up to 24 hours before being applied.

Or we can instead enable scripting on a specific site collection for it to take effect immediately, using the SharePoint Online Management Shell:

Connect-SPOService <SP Admin Centre URL>
Set-SPOSite <Site URL> -DenyAddAndCustomizePages 0

Updating Site Icon URL in SharePoint Online

By default, the SharePoint site icon on the top left of the default master pages will redirect users to the landing page of the current site they are in.


However, it’s sometimes useful for that site icon to be used to redirect back to the site collection home page instead.

We can do this with a bit of JavaScript. Assuming you already have a JS file (global.js in the example below) that is embedded as a User Custom Action, the following code should update the site icon’s URL on all pages: Continue reading

Update Web Part Chrome Type using PowerShell

Had an instance where a client had a been creating many pages and adding custom web parts using the Title Only chrome type onto those pages.

Then they turned around and decided they’d rather their web parts not display any title at all…

Well, PowerShell to the rescue!

Note: Code below is assuming it is a publishing site.  Continue reading

PowerShell to get Farm Administrator(s)

To get Primary Farm Administrator

$farm = Get-SPFarm


To get All Farm Administrators

$ca = Get-SPWebApplication - IncludeCentralAdministration | ? IsAdministrationWebApplication
$site = $ca.Sites["/"]
$web = $site.RootWeb
$group = $web.SiteGroups["Farm Administrators"]