A few days ago I was asked for a way to bulk upload and install multiple SharePoint solutions. In a simple and quick way that wouldn’t require much user interaction/scripting or experience.
With this in mind, I have created a simple PowerShell script using PnP PowerShell that reads information from a CSV. The script starts by uploading and deploying all the apps to the SharePoint app catalog. Once this step is completed, it then connects to the target site to install the solutions.
The script is very basic and only accounts for this simple scenario, which was my requirement. But it can be easily extended even if you don’t know much of PowerShell.
For instance, if you want the target site to be configured per app, simply add a new column to the CSV file and connect to that site before adding the app. Another scenario could be that you need your app to be globally available when deployed (for example an SPFx web part to be available across the tenant), and in this case, you would need a new CSV column to define that and add the property in the Publish-PnPApp command. You get the point…
The code is available on the following GitHub repository: Deploy Addins
To use this tool you only need to create your CSV file with the list of app names and titles, copy your app files to the packages folder and run the PowerShell script provided. The repository contains a sample CSV file that is using a solution package from the SharePoint Starter Kit as an example (please don’t use this file as it’s not up to date!)
The script takes the following parameters:
- appsFile – the name of the CSV file (example: apps.csv)
- siteUrl – the absolute url of the target site where the apps will be installed (example: https://myTenant.sharepoint.com)
- appCatalogUrl – the absolute url of the tenant app catalog where the apps will be uploaded (example: https://myTenant.sharepoint.com/sites/apps)
Now simply run the script and have fun 🙂