Module Name | schema | applicable | online version | external help file | title |
---|---|---|---|---|---|
PnP.PowerShell |
2.0.0 |
SharePoint Online |
PnP.PowerShell.dll-Help.xml |
Add-PnPJavaScriptBlock |
Adds a link to a JavaScript snippet/block to a web or site collection, valid only for SharePoint classic site experience.
Add-PnPJavaScriptBlock -Name <String> -Script <String> [-Sequence <Int32>] [-Scope <CustomActionScope>]
[-Connection <PnPConnection>]
Specify a scope as 'Site' to add the custom action to all sites in a site collection.
Add-PnPJavaScriptBlock -Name myAction -script '<script>Alert("This is my Script block");</script>' -Sequence 9999 -Scope Site
Add a JavaScript code block to all pages within the current site collection under the name myAction and at order 9999
Add-PnPJavaScriptBlock -Name myAction -script '<script>Alert("This is my Script block");</script>'
Add a JavaScript code block to all pages within the current web under the name myAction
Optional connection to be used by the cmdlet. Retrieve the value for this parameter by either specifying -ReturnConnection on Connect-PnPOnline or by executing Get-PnPConnection.
Type: PnPConnection
Parameter Sets: (All)
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
The name of the script block. Can be used to identify the script with other cmdlets or coded solutions
Type: String
Parameter Sets: (All)
Aliases: Key
Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
The scope of the script to add to. Either Web or Site, defaults to Web. 'All' is not valid for this command.
Type: CustomActionScope
Parameter Sets: (All)
Accepted values: Web, Site, All
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
The javascript block to add to the specified scope
Type: String
Parameter Sets: (All)
Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
A sequence number that defines the order on the page
Type: Int32
Parameter Sets: (All)
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False