Add and Remove Custom Action Using PnP PowerShell

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 Consulting 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

Softree Consulting is an award-winning SharePoint consultancy that has been working with clients from across the globe to transform workplaces with tools and platforms from Microsoft technology. As a widely recognized organization, we are commonly approached to incorporate technical excellence and innovative design into all our customer actions.....

Site Footer