In this blog article, I am going to add and remove custom action using PnP PowerShell.SharePoint-2013-Hosting

Adding a custom action to the SharePoint site

The Add-PnPCustomAction command is used to add a user custom action to a web or site collection.

Example

This example adds a new custom action to the Site Settings and sets the Title, Name and other fields with the specified values.

Add-PnPCustomAction -Name ‘Item Search’ -Title ‘Item Search’ -Description ‘Adds custom action to SiteSettings’ -Group ‘SiteAdministration’ -Location ‘Microsoft.SharePoint.SiteSettings’ -Sequence 1000 -Url ‘https://www.google.com’

Output

Getting the custom action information

The Get-PnPCustomAction command is used to return user custom action(s) of the web or current site collection.

Example 1

This example returns all custom actions of the current site.

Get-PnPCustomAction

Add And Remove Custom Action Using PnP PowerShell

Output

Example 2

This example returns the custom action with the id “47eaee71-7aa2-458a-8ca8-cbd48f5e68c3”.

Get-PnPCustomAction -Identity 47eaee71-7aa2-458a-8ca8-cbd48f5e68c3

Removing a custom action from the SharePoint site

The Remove-PnPCustomAction command is used to remove user custom action(s) from the current web or site collection.

Example

This example removes the custom action with the id “47eaee71-7aa2-458a-8ca8-cbd48f5e68c3”.

Add And Remove Custom Action Using PnP PowerShell
Remove-PnPCustomAction -Identity 47eaee71-7aa2-458a-8ca8-cbd48f5e68c3

Output