GitHub Icon Image
GitHub

List all SPFx field customizer

Summary

This is a simple PnP PowerShell script to list all SPFx field customizers in a SharePoint Online environment.

It's done by scarping your entire tenant, every site, and every field on every list, and checking if the ClientSideComponentId is set to a non-empty value, which indicates that the field has a customizer applied.

Example Screenshot

In light of the recent announcement from Microsoft you might want to get a holistic picture of your tenants usage of Field Customizers.

  • PnP PowerShell

$AdminUrl = "https://<Tenant>-admin.sharepoint.com/";



$FieldCustomizers = @()

Connect-PnPOnline $AdminUrl # <Your connection parameters go here>

$sites = Get-PnPTenantSite

foreach($site in $sites){
    Write-Host "Processing site: $($site.Url)" -ForegroundColor Cyan
    $siteCon = Connect-PnPOnline -Url $site.Url -ReturnConnection # <Your connection parameters go here>

    $lists = Get-PnPList -Connection $siteCon
    foreach($list in $lists){
        Write-Host "Processing list: $($list.Title)" -ForegroundColor Yellow
        $fields = Get-PnPField -List $list -Connection $siteCon 

        foreach($field in $fields){
            if($field.ClientSideComponentId -ne [Guid]::Empty){
                $FieldCustomizers += [PSCustomObject]@{
                    SiteUrl = $site.Url
                    ListTitle = $list.Title
                    FieldTitle = $field.Title
                    FieldInternalName = $field.InternalName
                    ClientSideComponentId = $field.ClientSideComponentId
                    ClientSideComponentProperties = $field.ClientSideComponentProperties
                }
            }
        }
    }
}

# Export the results to a CSV file
if ($FieldCustomizers.Count -eq 0) {
    Write-Host "No field customizers found." -ForegroundColor Red
    return
}

Write-host $FieldCustomizers | Format-Table -AutoSize

$FieldCustomizers | Export-Csv -Path "FieldCustomizers.csv" -NoTypeInformation

Check out the PnP PowerShell to learn more at: https://aka.ms/pnp/powershell

The way you login into PnP PowerShell has changed please read PnP Management Shell EntraID app is deleted : what should I do ?

Contributors

Author(s)
Dan Toft

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.

Back to top Script Samples
Generated by DocFX with Material UI