Skip to content

Latest commit

 

History

History
118 lines (88 loc) · 2.98 KB

Add-PnPJavaScriptLink.md

File metadata and controls

118 lines (88 loc) · 2.98 KB
external help file applicable schema
SharePoint Server 2013, SharePoint Server 2016, SharePoint Online
2.0.0

Add-PnPJavaScriptLink

SYNOPSIS

Adds a link to a JavaScript file to a web or sitecollection

SYNTAX

Add-PnPJavaScriptLink -Name <String>
                      -Url <String[]>
                      [-Sequence <Int>]
                      [-Scope <CustomActionScope>]
                      [-Web <WebPipeBind>]
                      [-Connection <SPOnlineConnection>]

DESCRIPTION

Creates a custom action that refers to a JavaScript file

EXAMPLES

------------------EXAMPLE 1------------------

PS:> Add-PnPJavaScriptLink -Name jQuery -Url https://code.jquery.com/jquery.min.js -Sequence 9999 -Scope Site

Injects a reference to the latest v1 series jQuery library to all pages within the current site collection under the name jQuery and at order 9999

------------------EXAMPLE 2------------------

PS:> Add-PnPJavaScriptLink -Name jQuery -Url https://code.jquery.com/jquery.min.js

Injects a reference to the latest v1 series jQuery library to all pages within the current web under the name jQuery

PARAMETERS

-Name

Name under which to register the JavaScriptLink

Type: String
Parameter Sets: (All)
Aliases: Key

Required: True
Position: Named
Accept pipeline input: False

-Scope

Defines if this JavaScript file will be injected to every page within the current site collection or web. All is not allowed in for this command. Default is web.

Type: CustomActionScope
Parameter Sets: (All)

Required: False
Position: Named
Accept pipeline input: False

-Sequence

Sequence of this JavaScript being injected. Use when you have a specific sequence with which to have JavaScript files being added to the page. I.e. jQuery library first and then jQueryUI.

Type: Int
Parameter Sets: (All)

Required: False
Position: Named
Accept pipeline input: False

-Url

URL to the JavaScript file to inject

Type: String[]
Parameter Sets: (All)

Required: True
Position: Named
Accept pipeline input: False

-Connection

Optional connection to be used by cmdlet. Retrieve the value for this parameter by eiter specifying -ReturnConnection on Connect-PnPOnline or by executing Get-PnPConnection.

Type: SPOnlineConnection
Parameter Sets: (All)

Required: False
Position: Named
Accept pipeline input: False

-Web

This parameter allows you to optionally apply the cmdlet action to a subweb within the current web. In most situations this parameter is not required and you can connect to the subweb using Connect-PnPOnline instead. Specify the GUID, server relative url (i.e. /sites/team1) or web instance of the web to apply the command to. Omit this parameter to use the current web.

Type: WebPipeBind
Parameter Sets: (All)

Required: False
Position: Named
Accept pipeline input: False

RELATED LINKS

SharePoint Developer Patterns and Practices