-
Notifications
You must be signed in to change notification settings - Fork 140
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #723 from reshmee011/main
New script to get spfx details
- Loading branch information
Showing
3 changed files
with
151 additions
and
0 deletions.
There are no files selected for viewing
91 changes: 91 additions & 0 deletions
91
scripts/spo-get-details-spfx-packages-tenant-sitecollection-appcatalog/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
--- | ||
plugin: add-to-gallery | ||
--- | ||
|
||
# Retrieve SPFx Details from Tenant and Site Collection App Catalogs | ||
|
||
## Summary | ||
|
||
This script will help to gather detailed information about SPFx solutions installed in SharePoint environment, such as API permissions, for auditing, inventory, or compliance purposes from both the tenant-level and site collection app catalogs. | ||
|
||
![Example Screenshot](assets/preview.png) | ||
|
||
### Prerequisites | ||
|
||
- The user account that runs the script must have access to the SharePoint Online site. | ||
|
||
# [PnP PowerShell](#tab/pnpps) | ||
|
||
```powershell | ||
$AdminCenterURL= Read-Host -Prompt "Enter admin tenant collection URL"; | ||
$tenantAppCatalogUrl = Get-PnPTenantAppCatalogUrl | ||
$dateTime = (Get-Date).toString("dd-MM-yyyy") | ||
$invocation = (Get-Variable MyInvocation).Value | ||
$directorypath = Split-Path $invocation.MyCommand.Path | ||
$fileName = "\InventorySPFx-" + $dateTime + ".csv" | ||
$OutPutView = $directorypath + $fileName | ||
cd $PSScriptRoot | ||
Connect-PnPOnline $tenantAppCatalogUrl -Interactive | ||
$appCatConnection = Get-PnPConnection | ||
Connect-PnPOnline $AdminCenterURL -Interactive | ||
$adminConnection = Get-PnPConnection | ||
$appsDetails = @() | ||
#Get associated sites with hub | ||
$sites = Get-PnPTenantSite -Detailed -Connection $adminConnection | Where-Object -Property Template -NotIn ("PWA#0","SRCHCEN#0", "REDIRECTSITE#0", "SPSMSITEHOST#0", "APPCATALOG#0", "POINTPUBLISHINGHUB#0", "POINTPUBLISHINGTOPIC#0","EDISC#0", "STS#-1") | ||
$RestMethodUrl = '/_api/web/lists/getbytitle(''Apps%20for%20SharePoint'')/items?$select=Title,LinkFilename,SkipFeatureDeployment,ContainsTeamsManifest,ContainsVivaManifest,SupportsTeamsTabs,WebApiPermissionScopesNote,ContainsTenantWideExtension,IsolatedDomain,PackageDefaultSkipFeatureDeployment,IsClientSideSolutionCurrentVersionDeployed,ExternalContentDomains,IsClientSideSolutionDeployed,IsClientSideSolution,AppPackageErrorMessage,IsValidAppPackage,SharePointAppCategory,AppDescription,AppShortDescription' | ||
$apps = (Invoke-PnPSPRestMethod -Url $RestMethodUrl -Method Get -Connection $appCatConnection).Value | ||
#export details of apps | ||
$apps| foreach-object{ | ||
$app = $_ | ||
$app | Add-Member -MemberType NoteProperty -name "Site Url" -value $tenantAppCatalogUrl | ||
$appsDetails += $app | ||
} | ||
$sites | select url | ForEach-Object { | ||
write-host "Processing Site:" $_.url -f Yellow | ||
$Site = Get-PnPTenantSite $_.url -Connection $adminConnection | ||
Connect-PnPOnline -Url $Site.url -Interactive | ||
$siteConnection = Get-PnPConnection | ||
try{ | ||
if((Get-PnPSiteCollectionAppCatalog -CurrentSite)){ | ||
$apps = (Invoke-PnPSPRestMethod -Url $RestMethodUrl -Method Get -Connection $siteConnection).Value | ||
$apps| foreach-object{ | ||
$app = $_ | ||
$app | Add-Member -MemberType NoteProperty -name "Site Url" -value $Site.url | ||
$appsDetails += $app | ||
} | ||
} | ||
} | ||
catch{ | ||
write-host -f Red $_.Exception.Message | ||
} | ||
} | ||
#Export the result Array to CSV file | ||
$appsDetails | Export-CSV $OutPutView -Force -NoTypeInformation | ||
``` | ||
|
||
[!INCLUDE [More about PnP PowerShell](../../docfx/includes/MORE-PNPPS.md)] | ||
|
||
*** | ||
|
||
## Source Credit | ||
|
||
Sample first appeared on [Retrieve SPFx Details from Tenant and Site Collection App Catalogs Using PowerShell](https://reshmeeauckloo.com/posts/powershell-get-spfx-details-tenant-sitecollection-appcatalog/) | ||
|
||
## Contributors | ||
|
||
| Author(s) | | ||
|-----------| | ||
| [Reshmee Auckloo](https://github.com/reshmee011) | | ||
|
||
|
||
[!INCLUDE [DISCLAIMER](../../docfx/includes/DISCLAIMER.md)] | ||
<img src="https://m365-visitor-stats.azurewebsites.net/script-samples/scripts/spo-get-details-spfx-packages-tenant-sitecollection-appcatalog" aria-hidden="true" /> |
Binary file added
BIN
+56.6 KB
...o-get-details-spfx-packages-tenant-sitecollection-appcatalog/assets/preview.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
60 changes: 60 additions & 0 deletions
60
scripts/spo-get-details-spfx-packages-tenant-sitecollection-appcatalog/assets/sample.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
[ | ||
{ | ||
"name": "spo-get-details-spfx-packages-tenant-sitecollection-appcatalog", | ||
"source": "pnp", | ||
"title": "Retrieve SPFx Details from Tenant and Site Collection App Catalogs", | ||
"shortDescription": "Retrieve detailed information about SPFx solutions installed in SharePoint environment, such as API permissions from both the tenant-level and site collection app catalogs.", | ||
"url": "https://pnp.github.io/script-samples/spo-get-details-spfx-packages-tenant-sitecollection-appcatalog/README.html", | ||
"longDescription": [ | ||
"Retrieve detailed information about SPFx solutions installed in SharePoint environment, such as API permissions, for auditing, inventory, or compliance purposes from both the tenant-level and site collection app catalogs." | ||
], | ||
"creationDateTime": "2024-08-09", | ||
"updateDateTime": "2024-08-09", | ||
"products": [ | ||
"SharePoint", | ||
"SPFx" | ||
], | ||
"metadata": [ | ||
{ | ||
"key": "PNP-POWERSHELL", | ||
"value": "2.5.0" | ||
} | ||
], | ||
"categories": [ | ||
"Report" | ||
], | ||
"tags": [ | ||
"modern", | ||
"Connect-PnPOnline", | ||
"Get-PnPTenantSite", | ||
"Get-PnPTenantAppCatalogUrl", | ||
"Get-PnPSiteCollectionAppCatalog", | ||
"Invoke-PnPSPRestMethod", | ||
"Get-PnPWeb", | ||
"Get-PnPApp" | ||
], | ||
"thumbnails": [ | ||
{ | ||
"type": "image", | ||
"order": 100, | ||
"url": "https://raw.githubusercontent.com/pnp/script-samples/main/scripts/spo-get-details-spfx-packages-tenant-sitecollection-appcatalog/assets/preview.png", | ||
"alt": "" | ||
} | ||
], | ||
"authors": [ | ||
{ | ||
"gitHubAccount": "reshmee011", | ||
"company": "", | ||
"pictureUrl": "https://avatars.githubusercontent.com/u/7693852?v=4", | ||
"name": "Reshmee Auckloo" | ||
} | ||
], | ||
"references": [ | ||
{ | ||
"name": "Want to learn more about PnP PowerShell and the cmdlets", | ||
"description": "Check out the PnP PowerShell site to get started and for the reference to the cmdlets.", | ||
"url": "https://aka.ms/pnp/powershell" | ||
} | ||
] | ||
} | ||
] |