0

I have created one spfx project to place the new option(custom option) in the Edit Control Block(ECB) menu for modern SharePoint site CustomList and it also works fine when i'm testing it on the localhost as shown in the below screenshot. enter image description here But after i have published the project and install the spfx add-in in my SharePoint site, the location of the option(custom option) is changed as shown in the below screenshot.

enter image description here

Can anyone please suggest for the solution, that the option(custom option) should be displayed in the ECB menu!

1 Answer 1

1

Looks like you made some error specifying the location in the User custom action while registering it.

Go to your sharepoint > assets > elements.xml file and change the location to ClientSideExtension.ListViewCommandSet.ContextMenu.

The xml should be something like:

<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
   <CustomAction
       Title="CustomEcb"
       RegistrationId="101"
       RegistrationType="List"
       Location="ClientSideExtension.ListViewCommandSet.ContextMenu"
       ClientSideComponentId="6c5b8ee9-43ba-4cdf-a106-04857c8307be"
       ClientSideComponentProperties="{&quot;targetUrl&quot;:&quot;ShowDetails.aspx&quot;}">
   </CustomAction>
</Elements>

Reference - Migrate from ECB to SPFx extensions

The possible values for location are as below:

  • ClientSideExtension.ListViewCommandSet.ContextMenu: The context menu of the list item / file in doc lib.
  • ClientSideExtension.ListViewCommandSet.CommandBar: The top command set menu in a list or library.
  • ClientSideExtension.ListViewCommandSet: Both the context menu and the command bar.

Once you have made the necessary changes, package the solution again and then register the custom action with correct location, it should show up in the context menu

2
  • Thanks Gautam for your solution, it will works only for one list template CustomList, but i want to implement the same functionality on multiple list templates also, for e.g Document Library, Picture Library, Issue Tracking etc etc. Can you suggest for the same. Thanks in Advance Jun 4, 2018 at 4:27
  • not sure about this , but will get back to you after trying out a couple of tests Jun 4, 2018 at 9:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.