1

I have created a ListView command set extension using SPFx and upload it in the app catalog. Now I want to install this extension for only particular sites.

I tried adding it as a custom action but it is not working.

Any help would be appreciated.

CustomActionEntity ca = new CustomActionEntity
                {
                    Title = "HelloWorld",
                    RegistrationId = "101",
                    RegistrationType = UserCustomActionRegistrationType.List,
                    Location = "ClientSideExtension.ListViewCommandSet.CommandBar",
                    ClientSideComponentId = spfxExtensionGlobalHeaderId,
                    ClientSideComponentProperties = "{"sampleTextOne":"One item is selected in the list.", "sampleTextTwo":"This command is always visible."}"
                };

         currentWeb.AddCustomAction(ca);
6
  • how did you tried to add it? Like we add any other app from Site Content? Sep 11, 2019 at 12:53
  • Also, please add the error you are getting. Sep 11, 2019 at 13:00
  • i am not getting any error but the command is not visible in the command after executing the code. Sep 11, 2019 at 14:24
  • Added code snippet used for adding as custom action. Sep 11, 2019 at 14:25
  • Did you try by adding the package manually in app catalog? Sep 12, 2019 at 10:58

1 Answer 1

0

I have successfully installed the extension using PnP App manager class.

AppManager appManager = new AppManager(clientContext);
var apps = appManager.GetAvailable();
foreach (var app in apps)
{
if (app.Title == "List View Command Set")
{
    appManager.Install(app);
}
}

Your Answer

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

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