Add custom action with add-pnpcustomaction

%3CLINGO-SUB%20id%3D%22lingo-sub-3240702%22%20slang%3D%22en-US%22%3EAdd%20custom%20action%20with%20add-pnpcustomaction%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3240702%22%20slang%3D%22en-US%22%3E%3CP%3EHello%2C%3C%2FP%3E%3CP%3EI'm%20trying%20to%20hide%20the%20delete%20button%20in%20SharePoint%20Online%20list%20ribbon%3B%20I%20tried%20with%20custom%20action%20and%20powershell%20but%20I'm%20blocked%20(see%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fsharepoint-developer%2Fspo-custom-action-to-hide-delete-button%2Fm-p%2F3221306%23M11052%22%20target%3D%22_blank%22%3ESPO%20custom%20action%20to%20hide%20delete%20button%20-%20Microsoft%20Tech%20Community%3C%2FA%3E%26nbsp%3B).%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWith%20other%20research%20I%20find%20that%2C%20maybe%2C%20is%20possible%20to%20add%20a%20custom%20action%20with%20the%20powershell%20cmdlet%20add-pnpcustomaction%20of%20Pnp.PowerShell%20module%3B%20I%20have%20seen%20the%20syntax%20of%20the%20cmdlet%20but%20I%20don't%20understand%20some%20thing%3B%20I%20have%20a%20list%2C%20only%20a%20SPO%20list%2C%20where%20I%20want%20to%20apply%20the%20custom%20action%3A%20is%20it%20possible%3F%3C%2FP%3E%3CP%3ESay%20I%20have%20the%20mytenant.sharepoint.com%2Fsites%2Ftestsite%20where%20I%20have%20some%20lists%2C%20but%20I%20want%20to%20hide%20the%20delete%20button%20in%20the%20mytestlist%3A%20how%20to%20reference%20it%20in%20the%20command%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EFrom%20some%20sample%20found%20online%20and%20also%20from%20the%20documentation%20sample%20I%20write%20something%20like%20this%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-powershell%22%3E%3CCODE%3EConnect-PnPOnline%20-Url%20%22https%3A%2F%2Fmytenant.sharepoint.com%2Fsites%2Ftestsite%22%20-Interactive%0A%24cUIExtn%20%3D%20%22%3CCOMMANDUIEXTENSION%3E%3CCOMMANDUIDEFINITIONS%3E%3CCOMMANDUIDEFINITION%20location%3D%22%22%20ribbon.listitem.manage.delete%3D%22%22%3E%3C%2FCOMMANDUIDEFINITION%3E%3C%2FCOMMANDUIDEFINITIONS%3E%3C%2FCOMMANDUIEXTENSION%3E%3C%2FCODE%3E%3C%2FPRE%3E%3C%2FLINGO-BODY%3E%22%0AAdd-PnPCustomAction%20-Name%20'HideDeleteButton'%20-Title%20'HideDeleteButton'%20-Location%20'CommandUI.Ribbon'%20-RegistrationType%20List%20-Sequence%2010000%20-RegistrationId%20101%20-CommandUIExtension%20%24cUIExtn%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EBut%2C%20my%202%20questions%20are%3A%3C%2FP%3E%3COL%3E%3CLI%3Eis%20it%20correct%3C%2FLI%3E%3CLI%3Ehow%20or%20where%20reference%20the%20list%3F%3C%2FLI%3E%3C%2FOL%3E%3CP%3EAny%20help%20is%20appreciated.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E--%3C%2FP%3E%3CP%3ERegards%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CLINGO-LABS%20id%3D%22lingo-labs-3240702%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EDeveloper%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EPnP%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Occasional Contributor

Hello,

I'm trying to hide the delete button in SharePoint Online list ribbon; I tried with custom action and powershell but I'm blocked (see SPO custom action to hide delete button - Microsoft Tech Community ).

 

With other research I find that, maybe, is possible to add a custom action with the powershell cmdlet add-pnpcustomaction of Pnp.PowerShell module; I have seen the syntax of the cmdlet but I don't understand some thing; I have a list, only a SPO list, where I want to apply the custom action: is it possible?

Say I have the mytenant.sharepoint.com/sites/testsite where I have some lists, but I want to hide the delete button in the mytestlist: how to reference it in the command?

 

From some sample found online and also from the documentation sample I write something like this:

 

Connect-PnPOnline -Url "https://mytenant.sharepoint.com/sites/testsite" -Interactive
$cUIExtn = "<CommandUIExtension><CommandUIDefinitions><CommandUIDefinition Location=""Ribbon.ListItem.Manage.Delete"" /></CommandUIDefinition></CommandUIDefinitions></CommandUIExtension>"
Add-PnPCustomAction -Name 'HideDeleteButton' -Title 'HideDeleteButton' -Location 'CommandUI.Ribbon' -RegistrationType List -Sequence 10000 -RegistrationId 101 -CommandUIExtension $cUIExtn

 

But, my 2 questions are:

  1. is it correct
  2. how or where reference the list?

Any help is appreciated.

 

--

Regards

 

0 Replies