Add and Remove Custom Action Using PnP PowerShell

  • Posted by: Softree Technology

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

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

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”.

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

Output:

This solution is brought to you by our SharePoint professionals.

Softree Technology employs SharePoint consultants; we are a technology services provider with the aim to help companies achieve exceptional performance through SharePoint. Our dedicated team of SharePoint consultants has the right bent of mind to understand and execute customer requirements.

Be it SPFx or SharePoint add-in developments, SharePoint 2019 developments, web part developments, migrating from SharePoint 2010/2013 to SharePoint 2013/2016/Office 365, Office 365, SharePoint hosted apps development or something else in SharePoint, we strive to deliver the best

Author: Softree Technology

Leave a Reply