Cli-microsoft365: 鉂換uestion : use case with 'spo app install' cmdlet

Created on 6 Feb 2019  路  2Comments  路  Source: pnp/cli-microsoft365

My use case

  1. I developed a xFx extension for SharePoint 馃コ
  2. I have to add my solution package to the AppCatalog of the target site collection (spo app add : it works)
  3. I have to deploy my solution package from the AppCatalog of the target site collection (spo app deploy : it works)
  4. I have to install my solution package from the AppCatalog of the target site collection (spo app install : it works)
  5. I have to define a custom action that come from my solution. Necessary to define some custom properties (spo customaction add : it works)

It works !!!

So what's wrong ??? Because I'm using spo app install my extension is enable a first time without property AND a second time from my custom action with the good parameters.

Globally it works, but my extension is active two times on my site collection and one of them is not set up correctly.

  1. Is it possible while the install cmdlet to disable custom action ?
  2. Is it possible to return the ID of the custom action to disable it after install cmdlet ?

Other idea ?

Most helpful comment

Good point @VelinGeorgiev !
I didn't think about element.xml... I commented the <CustomAction> node.

<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
    <!--<CustomAction
        Title="MyCustomExtension"
        Location="ClientSideExtension.ApplicationCustomizer"
        ClientSideComponentId="ID"
        ClientSideComponentProperties="{&quot;message&quot;:&quot;My Custom Message&quot;}">
    </CustomAction>-->
</Elements>

Thx

All 2 comments

spo app install is just calling the rest API for install. I am not sure what the API is doing under the hood. In my opinion it should not deploy a custom action unless this is declared in your elements.XML (features XML) in the solution package (your-foldr/SharePoint/siteassets).

https://docs.microsoft.com/en-us/sharepoint/dev/spfx/web-parts/get-started/provision-sp-assets-from-package

  1. Disabling the feature XML or custom action in it means that we have to open and modify the solution package. Not sure if this is the intention. Developer can just modify the XML and remove the custom action from the source code XML before packaging.

  2. You might have loads of custom actions so should be a list of , but still we have to open the solution package and scan for custom actions and identifiers for them so we can query later and find their IDs.

Good point @VelinGeorgiev !
I didn't think about element.xml... I commented the <CustomAction> node.

<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
    <!--<CustomAction
        Title="MyCustomExtension"
        Location="ClientSideExtension.ApplicationCustomizer"
        ClientSideComponentId="ID"
        ClientSideComponentProperties="{&quot;message&quot;:&quot;My Custom Message&quot;}">
    </CustomAction>-->
</Elements>

Thx

Was this page helpful?
0 / 5 - 0 ratings