SharePoint Site Collection App Catalog Feature

Details about SharePoint Site Collection App Catalog Feature and the process to enable and disable it

As a SharePoint app developer, I have to work with SPFx solution and Add-ins. So, in that process, previously we deployed them in the Tenant Level App Catalog. Usually, in Office 365 tenant, a site is being used as an app catalog. And to deploy the Add-ins/SPFX Solution, the user has to have contributer permission at minimum. Also, the deployed package will be visible on all site collections which is a problem sometimes.

Mostly in a Software development lifecycle,  deploying the multiple instances of the same SPFx web part in the same catalog creates a big problem. And this becomes a problem for us, as these development, staging or production versions can be different based on the development timeline. But the app always gets the web-part files from only one CDN location. So, here we need multiple app packages deployed in the app catalog. But whenever we try to deploy the app package to the catalog, it is updating only the instances previously deployed. Even if we try to change the name, it will not work. Though there is a workaround to Deploy multiple instances of SPFx Web-part in the same app catalog.

SharePoint
Fig: Tenant Specific App Catalog

Site Collection App Catalog

In early November 2017, Microsoft released the Site Collection App Catalog feature. So, the tenant administrators can enable app catalog on the specific sites. After that, the site collection administrators can deploy SharePoint add-ins and SPFx solutions which will be available only in that particular site collection. For information about building modern Web Parts using the SharePoint Framework, see Overview of the SharePoint Framework. By using Site Collection App Catalog, we can resolve the issue of the "multiple instance deployment" problem.

SharePoint  
Fig: Site Collection App Catalog

Add Site Collection App Catalog

First, the Site Collection needs to be added to the tenant's allow list. Adding a Site Collection to the list enables the Site Collection App Catalog feature on the site, and authorizes its use. To enable this, we need to run some power shell or Office 365 CLI commands. Here we will use Office 365 CLI. First, to connect with the tenant, the following command needs to be run like:

  • spo connect https://tahmid.sharepoint.com
    In the next step, to enable the site collection app catalog to need to run the following command. 
  • spo site appcatalog add --url https://tahmid.sharepoint.com /sites/site-collection
    After completing the above process, if we go back to that specific SharePoint Online site, we will find the app catalog in the Site Contents.

SharePoint
Fig: Site Collection App Catalog in Site Content

Disable Site Collection App Catalog

We can also disable the site collection app catalog. Here it’s worth mentioning that in some articles, it says that “Remove” site collection app catalog. But it is not really removing anything. The naming is a bit misleading. When we run the script, the app catalog will just disable it, by telling SharePoint to no longer treat the app catalog as an app catalog. Behind the scenes, SharePoint just treats the library like a normal SharePoint document library.

First  we needto connect with the tenant, spo connect command needs to run like this:

  • spo connect https://tahmid.sharepoint.com
    In the next step, we need to run the following command, it's a pretty similar procedure to adding the app catalog.

  • spo site appcatalog remove --url https://tahmid.sharepoint.com/sites/site-collection

Conclusion

Site Collection app catalog is a good feature in terms of development overview. But as this site collection can be accessed by the site collection administrator, the organization should reconsider their policies if there is any compliance issue. And in a case where the app needs to use in the multiple site collections, the app must be deplyed to the Tenant Level App Catalog.