Enable Site Collection App Catalog on a specific sites using CSV
Summary
The script reads list of SharePoint site collection URLs from a CSV and enables the Site collection app catalog on them.
Implementation
- Create csv file with the list of site collection URLs to enable app catalog
- Open Windows PowerShell ISE
- Create a new file
- Copy the code below
- Save the file and run it
- Make sure you must have access to the app catalog to apply
# Example: .\Enable-SiteCollectionAppCatalog.ps1 -AdminUrl "https://contoso-admin.sharepoint.com" -CsvPath ".\SiteURLs.csv"
[CmdletBinding()]
param (
[Parameter(Mandatory = $true, HelpMessage = "URL of the SharePoint Admin Center, e.g.https://contoso-admin.sharepoint.com")]
[string]$AdminUrl,
[Parameter(Mandatory = $false, HelpMessage = "Path to CSV file with list of SharePoint sites to enable Site Collection App Catalog")]
[string]$CsvPath = ".\SiteURLs.csv"
)
begin {
Write-Host "Connecting to SharePoint Admin Site '$($AdminUrl)'" -f Yellow
Connect-SPOService -Url $AdminUrl
}
process {
$data = Import-Csv -Path $CsvPath
$data | Foreach-Object{
Write-Host "Adding site collection app catalog to site '$($_.SiteUrl)'..." -f Yellow
$site = Get-SPOSite $_.SiteUrl
Add-SPOSiteCollectionAppCatalog -Site $site
}
}
end {
Disconnect-SPOService
Write-Host "Finished" -ForegroundColor Green
}
Check out the SPO Management Shell to learn more at: Introduction SharePoint Online Management Shell | Microsoft Docs
Contributors
Author(s) |
---|
Nanddeep Nachan |
Disclaimer
THESE SAMPLES ARE PROVIDED AS IS WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.