external help file | applicable | schema |
---|---|---|
SharePoint Server 2013, SharePoint Server 2016, SharePoint Online |
2.0.0 |
Adds a custom action
Add-PnPCustomAction -Name <String>
-Title <String>
-Location <String>
-ClientSideComponentId <GuidPipeBind>
[-RegistrationId <String>]
[-RegistrationType <UserCustomActionRegistrationType>]
[-Scope <CustomActionScope>]
[-ClientSideComponentProperties <String>]
[-Web <WebPipeBind>]
[-Connection <SPOnlineConnection>]
Add-PnPCustomAction -Name <String>
-Title <String>
-Description <String>
-Group <String>
-Location <String>
[-Sequence <Int>]
[-Url <String>]
[-ImageUrl <String>]
[-CommandUIExtension <String>]
[-RegistrationId <String>]
[-Rights <PermissionKind[]>]
[-RegistrationType <UserCustomActionRegistrationType>]
[-Scope <CustomActionScope>]
[-Web <WebPipeBind>]
[-Connection <SPOnlineConnection>]
Adds a user custom action to a web or sitecollection.
$cUIExtn = "<CommandUIExtension><CommandUIDefinitions><CommandUIDefinition Location=""Ribbon.List.Share.Controls._children""><Button Id=""Ribbon.List.Share.GetItemsCountButton"" Alt=""Get list items count"" Sequence=""11"" Command=""Invoke_GetItemsCountButtonRequest"" LabelText=""Get Items Count"" TemplateAlias=""o1"" Image32by32=""_layouts/15/images/placeholder32x32.png"" Image16by16=""_layouts/15/images/placeholder16x16.png"" /></CommandUIDefinition></CommandUIDefinitions><CommandUIHandlers><CommandUIHandler Command=""Invoke_GetItemsCountButtonRequest"" CommandAction=""javascript: alert('Total items in this list: '+ ctx.TotalListItems);"" EnabledScript=""javascript: function checkEnable() { return (true);} checkEnable();""/></CommandUIHandlers></CommandUIExtension>"
Add-PnPCustomAction -Name 'GetItemsCount' -Title 'Invoke GetItemsCount Action' -Description 'Adds custom action to custom list ribbon' -Group 'SiteActions' -Location 'CommandUI.Ribbon' -CommandUIExtension $cUIExtn
Adds a new custom action to the custom list template, and sets the Title, Name and other fields with the specified values. On click it shows the number of items in that list. Notice: escape quotes in CommandUIExtension.
The Client Side Component Id of the custom action
Type: GuidPipeBind
Parameter Sets: Client Side Component Id
Required: True
Position: Named
Accept pipeline input: False
The Client Side Component Properties of the custom action. Specify values as a json string : "{Property1 : 'Value1', Property2: 'Value2'}"
Type: String
Parameter Sets: Client Side Component Id
Required: False
Position: Named
Accept pipeline input: False
XML fragment that determines user interface properties of the custom action
Type: String
Parameter Sets: Default
Required: False
Position: Named
Accept pipeline input: False
The description of the custom action
Type: String
Parameter Sets: Default
Required: True
Position: Named
Accept pipeline input: False
The group where this custom action needs to be added like 'SiteActions'
Type: String
Parameter Sets: Default
Required: True
Position: Named
Accept pipeline input: False
The URL of the image associated with the custom action
Type: String
Parameter Sets: Default
Required: False
Position: Named
Accept pipeline input: False
The actual location where this custom action need to be added like 'CommandUI.Ribbon'
Type: String
Parameter Sets: Default
Required: True
Position: Named
Accept pipeline input: False
The name of the custom action
Type: String
Parameter Sets: Default
Required: True
Position: Named
Accept pipeline input: False
The identifier of the object associated with the custom action.
Type: String
Parameter Sets: Default
Required: False
Position: Named
Accept pipeline input: False
Specifies the type of object associated with the custom action
Type: UserCustomActionRegistrationType
Parameter Sets: Default
Required: False
Position: Named
Accept pipeline input: False
A string array that contain the permissions needed for the custom action
Type: PermissionKind[]
Parameter Sets: Default
Required: False
Position: Named
Accept pipeline input: False
The scope of the CustomAction to add to. Either Web or Site; defaults to Web. 'All' is not valid for this command.
Type: CustomActionScope
Parameter Sets: Default
Required: False
Position: Named
Accept pipeline input: False
Sequence of this CustomAction being injected. Use when you have a specific sequence with which to have multiple CustomActions being added to the page.
Type: Int
Parameter Sets: Default
Required: False
Position: Named
Accept pipeline input: False
The title of the custom action
Type: String
Parameter Sets: Default
Required: True
Position: Named
Accept pipeline input: False
The URL, URI or ECMAScript (JScript, JavaScript) function associated with the action
Type: String
Parameter Sets: Default
Required: False
Position: Named
Accept pipeline input: False
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
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
SharePoint Developer Patterns and PracticesUserCustomActionBasePermissions