• 512-991-7197
  • This email address is being protected from spambots. You need JavaScript enabled to view it.
  • Always Open

Welcome to Microsoft SharePoint Tips & Tricks

Installing all SPFx solutions in a folder


Star InactiveStar InactiveStar InactiveStar InactiveStar Inactive
 

When you decide to install SharePoint Frameworks solutions probably you install multiple solutions on the site to test which work on your SharePoint. That process can consume some time of your daily work and the with PnP PowerShell you will have a way to deploy each solution faster and cleaner.

With the following script, you can deploy multiple SharePoint Framework solution to your tenant app catalog or Site App catalog. If you intend to know more about this, check at the reference section with the name.

We’ll store all the solutions on a folder and then they will be added automatically to your SharePoint. Make sure that you have the folder path on the $path variable and end with \* so the PowerShell can select all the files on the folder.  

$loginUrl   = "https://contoso.sharepoint.com/sites/contoso"
$path       = "C:\Users\contoso\Documents\BackupApps\*"

Connect-PnPOnline $loginUrl -UseWebLogin
$apps = Get-Item $path 
$ReadHost = Read-Host "Do you want to install the solution at the Tenant App Catalog(yes) or Site App Catalog(no)?"
if($ReadHost -match 'y'){
 $value = "Tenant"
}else{
 $value = "Site"
}

foreach($app in $apps){
  Write-Host "Installing file" $app.Name -NoNewline
  #It'll overwrite any file with the same id and make the solution available globally
  Add-PnPApp -Path $app.FullName -Scope $value -SkipFeatureDeployment -Overwrite -Publish | Out-Null
  Write-Host " Done" -BackgroundColor Green -ForegroundColor Black
}
install 1

Conclusion

When this process is concluded, depending on your installation, you’ll have all the SharePoint solutions store on the folder installed on your SharePoint site. This example can be used if you intend to install on your Solutions that were stored as Backup, article at the reference zone.


© 2015 - 2020 Austin Laptop [AustinLaptop.Com]. All Rights Reserved.