Overview
While deployment of apps / add-ins or SPFx solutions to SharePoint Online App Catalog, this solution will be available to all of collections in your tenant as it is centrally deployed. This may lead to a lot of confusion when you are working with a lot of solutions in your Tenant, as all of solutions is available to all site collections as it is deployed centrally in Tenant app catalog.To overcome this problem, Microsoft has introduces Site Collection App Catalog.With the introduction of site collection app catalogs, tenant administrators can enable app catalog on the specific sites. Once enabled, site collection administrators can deploy SharePoint add-ins and SPFx solutions that will be available only in that particular site collection.
The following schema illustrates using site collection app catalogs
Use below script to Enable / disable site collection app catalog
To Enable Site Collection App Catalog
$siteUrl = "https://yourdomain-admin.sharepoint.com"
$password = "******"
$username = "accountname@domain.com"
try{
$encpassword = convertto-securestring -String $password -AsPlainText -Force
$cred = New-Object -typename System.Management.Automation.PSCredential($username, $encpassword)
#Connect to SharePoint Service
Connect-SPOService -Url $siteUrl -Credential $cred
Write-Output $("Connected to $siteUrl")
$site = Get-SPOSite https://domain.sharepoint.com/sites/sitecollectionname
# create site collection app catalog
Add-SPOSiteCollectionAppCatalog -Site $site
Write-Output $("Site Collection App Catalog feature on $siteUrl is Enabled")
}
catch [System.Exception]
{
Write-Output -f red $_.Exception.ToString()
}
To Disable Site Collection App Catalog
$siteUrl = "https://yourdomain-admin.sharepoint.com"$password = "******"
$username = "accountname@domain.com"
try{
$encpassword = convertto-securestring -String $password -AsPlainText -Force
$cred = New-Object -typename System.Management.Automation.PSCredential($username, $encpassword)
#Connect to SharePoint Service
Connect-SPOService -Url $siteUrl -Credential $cred
Write-Output $("Connected to $siteUrl")
$site = Get-SPOSite https://domain.sharepoint.com/sites/sitecollectionname
# disable the site collection app catalog
Remove-SPOSiteCollectionAppCatalog -Site $site
Write-Output $("Site Collection App Catalog feature on $siteUrl is disabled")
}
catch [System.Exception]
{
Write-Output -f red $_.Exception.ToString()
}
Limitation
- SharePoint Online Management Shell should be installed
- Not compatible with PnP PowerShell
- Currently, it's not possible to list all site collections in the tenant that have the site collection app catalog enabled. So, you can create an SharePoint list for inventory
Reference
https://docs.microsoft.com/en-us/sharepoint/dev/general-development/site-collection-app-catalog

Comments
Post a Comment