Domanda

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!

È stato utile?

Soluzione

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

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a sharepoint.stackexchange
scroll top