Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Enable jQuery in Office 365
param(
[string]$SiteUrl,
[string]$UserName,
[string]$Password
)
. ".\UserCustomActions.ps1"
<#
.SYNOPSIS
Enable jQuery Library
.DESCRIPTION
Enable jQuery Library in Office 365/SharePoint Online site
.EXAMPLE
.\Activate-JQuery.ps1 -SiteUrl "https://tenant-public.sharepoint.com" -UserName "username@tenant.onmicrosoft.com" -Password "password"
#>
Function Activate-JQuery([string]$SiteUrl,[string]$UserName,[string]$Password)
{
$context = New-Object Microsoft.SharePoint.Client.ClientContext($SiteUrl)
$context.Credentials = Get-SPOCredentials -UserName $UserName -Password $Password
$sequenceNo = 1482
$jQueryUrl = "~SiteCollection/Style Library/Scripts/jQuery/jquery-2.1.1.js"
Add-ScriptLinkAction -Context $Context -ScriptSrc $jQueryUrl -Sequence $sequenceNo
$context.Dispose()
}
Activate-JQuery -SiteUrl $SiteUrl -UserName $UserName -Password $Password
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment