Skip to content

Instantly share code, notes, and snippets.

@vgrem
Created September 24, 2014 21:09
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vgrem/e00da5f4f5dd847943d0 to your computer and use it in GitHub Desktop.
Save vgrem/e00da5f4f5dd847943d0 to your computer and use it in GitHub Desktop.
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