How to enumerate SPFx solutions in a SharePoint app catalog
What is installed in this app catalog, and at which versions?
30-second answer
Get-PnPApp -Scope Site |
Select-Object Title, AppCatalogVersion, InstalledVersion, Deployed
Use -Scope Tenant for the tenant app catalog, -Scope Site for a site
collection app catalog. They are different lists.
What this proves
What the catalog holds, whether each package is deployed, and the two versions that matter: the one the catalog offers and the one actually installed. A gap between them is an upgrade nobody has applied.
What it does not prove
- Whether a solution is used. The catalog does not record usage, and the words "unused", "orphaned" and "not in use" cannot be derived from it. Component usage on pages is a separate, expensive question with its own article.
- What the package contains. The catalog metadata is seven properties; the contents of the .sppkg are not among them.
PowerShell
Get-PnPApp -Scope Site |
Where-Object { $_.InstalledVersion -and
"$($_.InstalledVersion)" -ne "$($_.AppCatalogVersion)" } |
Select-Object Title, InstalledVersion, AppCatalogVersion
Example output
Title InstalledVersion AppCatalogVersion
----- ---------------- -----------------
Corp News Parts 1.2.0.0 1.4.0.0
Explanation
InstalledVersion is empty when the package sits in the catalog without
being installed on the connected site, so treat "empty" and "behind" as
different states. An installed version behind the catalog means someone
shipped an update and the site never received it, which is how tenants end
up running web part code that was fixed months ago.
Production considerations
- A site collection app catalog exists only where it was created. Absence of the catalog is a normal state, not an error.
- Reading the tenant catalog needs rights on the tenant app catalog site; a site catalog needs rights on that site.
- The web part ids used on pages are not package ids. Joining "what is in the catalog" to "what is on the pages" is not a key lookup the product offers, and any tool that claims it is inferring.
References
- Manage apps using the Apps site (Microsoft Learn)
- Get-PnPApp (PnP PowerShell)
