Question

I'm using SPFx version 1.4 for SharePoint Server 2019.

I've created a Command Set for document library for global deployment on the whole tenant. Basically, it should work on each document library on the tenant. Is it even possible?

I have read these docs, but it is still rather confusing for me:

  1. Tenant-wide Deployment of SharePoint Framework Extensions

  2. Tenant-scoped solution deployment for SharePoint Framework solutions

elements.xml:

<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
    <CustomAction
        Title="DirectLink"
        RegistrationId="101"
        RegistrationType="List"
        Location="ClientSideExtension.ListViewCommandSet.CommandBar"
        ClientSideComponentId="1b9509d2-3c62-4ef4-bce6-5af4f7329819"
        ClientSideComponentProperties="{&quot;sampleTextOne&quot;:&quot;One item is selected in the list.&quot;, &quot;sampleTextTwo&quot;:&quot;This command is always visible.&quot;}">
    </CustomAction>
</Elements>

ClientSideInstance.xml:

<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
    <ClientSideComponentInstance
        Title="DirectLink"
        Location="ClientSideExtension.ListViewCommandSet.CommandBar"
        ListTemplateId="101"
        Properties="{&quot;sampleTextOne&quot;:&quot;One item is selected in the list.&quot;, &quot;sampleTextTwo&quot;:&quot;This command is always visible.&quot;}"
        ComponentId="1b9509d2-3c62-4ef4-bce6-5af4f7329819" />
</Elements>

package-solution.json:

{
  "$schema": "https://developer.microsoft.com/json-schemas/spfx-build/package-solution.schema.json",
  "solution": {
    "name": "direct-link-cs-client-side-solution",
    "id": "b7a6e855-9f2c-49ae-8d52-430a6de2380e",
    "version": "1.0.0.4",
    "includeClientSideAssets": true,
    "skipFeatureDeployment": true,
    "features": [{
      "title": "Direct Link Command Set Feature",
      "description": "Adds custom command to the libraries",
      "id": "dfa52f6c-685f-451a-b725-88859c8c61a9",
      "version": "1.0.0.0",
      "assets": {
        "elementManifests": [
          "elements.xml",
          "clientsideinstance.xml"
        ]
      }
    }]
  },
  "paths": {
    "zippedPackage": "solution/direct-link-cs.sppkg"
  }
}

DirectLinkCommandSet.manifest.json:

{
  "$schema": "https://developer.microsoft.com/json-schemas/spfx/command-set-extension-manifest.schema.json",

  "id": "1b9509d2-3c62-4ef4-bce6-5af4f7329819",
  "alias": "DirectLinkCommandSet",
  "componentType": "Extension",
  "extensionType": "ListViewCommandSet",

  // The "*" signifies that the version should be taken from the package.json
  "version": "*",
  "manifestVersion": 2,

  // If true, the component can only be installed on sites where Custom Script is allowed.
  // Components that allow authors to embed arbitrary script code should set this to true.
  // https://support.office.com/en-us/article/Turn-scripting-capabilities-on-or-off-1f2c515f-5d7e-448a-9fd7-835da935584f
  "requiresCustomScript": false,

  "items": {
    "COMMAND_1": {
      "title": {
        "default": "Direct link"
      },
      "iconImageUrl": "",
      "type": "command"
    }
  }
}

After installation in app catalog, Command Set is still not visible in Document Libraries. But it works if I deploy it only on specific site and not tenant-wide.

Was it helpful?

Solution

I believe Trevor Seward is correct about Sp2019 not supporting that deployment scenario.

You will have to enable your Command Set / Application Extension on each site and sub-site initially, using PnP PowerShell (take a look at Install-PnpApp) Future updates to the Command Set should get applied automatically once you deploy the updated solution in the App Catalog.

OTHER TIPS

SharePoint Server 2019 does not support 'tenant-wide' deployments so you will need to install it per-site.

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top