In this article, we will learn how to enable site collection app catalog. By enabling the site collection level app catalog (not the tenant), we can deploy/install SharePoint AddIn/SPFx solutions at the site collection level. Consider this like sandbox solution, as a component is only deployed and is installed on the site collection and not available for other site collections.
There are times and cases when we, as a developer, have to build a solution which is very much specific to a particular project or application. This solution demands a very determined approach to solving a specific problem which is not required for other site collections of your tenant. Below are some of the reasons why we need a site collection app catalog.
Once installed, open SharePoint Online Management Shell.
Connect to the Tenant.
- Connect-SPOService -Url https:
Connect to the particular site and run Add-SPOSiteCollectionAppCatalog.
- # get a reference to the site collection where the
- # site collection app catalog should be created
- $site = Get-SPOSite https:.sharepoint.com/sites/justiceleague
-
- # create site collection app catalog
- Add-SPOSiteCollectionAppCatalog -Site $site
Once you go to the site collection, you will see the app for SharePoint library which can be used to deploy the app.
Option 1 - Using Office365 CLI
We can also use PnP Office365 CLI. See this ummary of what Office 365 CLI is: (
reference link)
Using the Office 365 CLI, you can manage your Microsoft Office 365 tenant and SharePoint Framework projects on any platform. No matter if you are on Windows, macOS or Linux, using Bash, Cmder or PowerShell, using the Office 365 CLI you can configure Office 365, manage SharePoint Framework projects and build automation scripts.
Install Office 365 CLI (if not already installed.). Office 365 comes as NPM package which can be installed from Node JS prompt using below command,
- npm i -g @pnp/office365-cli
Go to Office 365 CLI. type below command in Node JS command prompt.
Now we are in office 365 CLI and can run office 365 CLI commands.
The next step is to log into Office 365 tenant.
It will give us the below message.
To sign in, use a web browser to open the page https://microsoft.com/devicelogin and enter the code SAVEGOTHAM to authenticate.
Open https://microsoft.com/devicelogin in the browser - Enter the code and click "Next".
Select the account or sign in with a new account,
Click Accept
We will get the below success message, close window.
Go back to Node JS command prompt, run below command to enable app catalog on the particular site collection.
- spo site appcatalog add --url https:
If successful, we can go to a particular site and see that the App for SharePoint library should be created.
Now we can directly deploy or App/Add-In or SPFx solution(*.sppkg) directly on the site collection. Deployment and installation of the app is similar to what we do for tenant app catalog.
How to disable the site collection app catalog?
Using Powershell
- # get a reference to the site collection in which
- # the site collection app catalog should be disabled
- $site = Get-SPOSite https:
-
- # disable the site collection app catalog
- Remove-SPOSiteCollectionAppCatalog -Site $site
Using Office 365 CLI
- spo site appcatalog remove --url https:
Conclusion
In this article, we have learned how to enable app catalog on the site collection level using PowerShell and Office 365 CLI.
Thanks for reading.