Get SharePoint Custom List Form details using PowerShell
Custom list forms in SharePoint Online are created using Power Apps, but they’re not actually Power Apps themselves. They are tightly-coupled to the underlying SharePoint List/Library and will not be visible in Power Platform Admin Center (PPAC) or in https://make.powerapps.com. The only way to get to them is to edit the custom list form from your SharePoint Online site. Well, what if you need to get some list or site information about your list forms in your environment? Here’s how we can do that in PowerShell:
Requirements
- PowerShell 3.x or higher (launched as Administrator if you need to install the module below)
- Install-Module Microsoft.PowerApps.Administration.PowerShell
Script
$tenantID='your-tenant-id'
Add-PowerAppsAccount -TenantID $tenantID
################################# APPS ################################
$e = Get-AdminPowerAppEnvironment
$apps = Get-AdminPowerApp -EnvironmentName $($e.EnvironmentName)
$results = @()
foreach($a in $apps){
$arrDate = $($a.CreatedTime -split 'T')
$arrTime = $($arrDate[1].Substring(0,8))
$arrLMDate = $($a.LastModifiedTime -split 'T')
$arrLMTime = $($arrLMDate[1].Substring(0,8))
if($a.Internal.properties.connectionReferences -ne $null){
$conns = $a.Internal.properties.connectionReferences | Get-Member -MemberType NoteProperty
foreach($cr in $conns){
$rawdata = $($cr.Definition -split "=@{")[1]
$propdata = ConvertFrom-String $rawdata
$app = [PSCustomObject]@{
Environment=$e.DisplayName
AppName=$a.AppName
AppDisplayName=$a.DisplayName
OwnerId=$a.Owner.id
OwnerDisplayName=$a.Owner.displayName
OwnerEmail = $a.Owner.email
OwnerUPN=$a.Owner.userPrincipalName
BypassConsent=$a.BypassConsent
Created=$([datetime]::parseexact($arrDate[0] + " " + $arrTime, 'yyyy-MM-dd HH:mm:ss', $null))
Modified=$([datetime]::parseexact($arrLMDate[0] + " " + $arrLMTime, 'yyyy-MM-dd HH:mm:ss', $null))
ConnectorName=$($propdata.P1)
ConnectorId=$($($propdata.P2 -split "=")[1].Trim(';'))
Site=$a.Internal.properties.embeddedApp.siteId
ListUrl=$a.Internal.properties.embeddedApp.listUrl
ListId=$a.Internal.properties.embeddedApp.listId
}
$results += $app
}
}
}
Write-Output $results | ogv