We can execute the below PnP PowerShell:
$rootUrl = "https://yourDomain.sharepoint.com" # enter your URL
Connect-PnPonline $rootUrl
Get-PnPTenantSite |
foreach {
Write-Host "Checking " $_.Url; # status message, delete if not needed.
Connect-PnPonline $_.url
$web = Get-PnPWeb
$parentTitle = $web.Title
$parentUrl = $web.Url
$listsIncForm = Get-PnPList
forEach ( $list in $listsIncForm) {
$listTitle = $list.Title
$listType = $list.BaseTemplate
$listUrl = $list.DefaultViewUrl
if ( $listType -eq 100 -or $listType -eq 101 ) {
$currList = Get-PnPList $listTitle -Includes ContentTypes, Forms, IsSystemList
$listForms = $currList.Forms
$isSysList = $currList.IsSystemList
if ( $isSysList ) {
#Write-Host 'Sys List Ignore'
} else {
if ( $listType -eq 101 ) {
$contentTAllow = $currList.AllowContentTypes
if ( $contentTAllow ) {
$contentTyps = $currList.ContentTypes
forEach ($contType in $contentTyps) {
if ( $contType.Name -eq 'Form' ) {
Write-Host "InfoPath Found in Library" $listTitle " at URL " $listUrl -ForegroundColor Green
}
}
}
}
else {
forEach ( $listFm in $listForms ) {
$listPath = $listFm.ServerRelativeUrl
if ( $listPath -like '*displayifs.aspx' ) {
Write-Host 'InfoPath Found in List ' $listTitle " at URL " $listUrl -ForegroundColor Green
}
}
}
}
}
}
Get-PnPSubWebs -Recurse |
where { $_.url -like $rootUrl+"*" } | # skip app sites and OneDrives
foreach {
Write-Host "Checking " $_.Url; # status message, delete if not needed.
Connect-PnPOnline -Url $_.Url
$web = Get-PnPWeb
$parentTitle = $web.Title
$parentUrl = $web.Url
$listsIncForm = Get-PnPList
forEach ( $list in $listsIncForm) {
$listTitle = $list.Title
$listType = $list.BaseTemplate
$listUrl = $list.DefaultViewUrl
if ( $listType -eq 100 -or $listType -eq 101 ) {
$currList = Get-PnPList $listTitle -Includes ContentTypes, Forms, IsSystemList
$listForms = $currList.Forms
$isSysList = $currList.IsSystemList
if ( $isSysList ) {
#Write-Host 'Sys List Ignore'
} else {
if ( $listType -eq 101 ) {
$contentTAllow = $currList.AllowContentTypes
if ( $contentTAllow ) {
$contentTyps = $currList.ContentTypes
forEach ($contType in $contentTyps) {
if ( $contType.Name -eq 'Form' ) {
Write-Host "InfoPath Found in Library" $listTitle " at URL " $listUrl -ForegroundColor Green
}
}
}
}
else {
forEach ( $listFm in $listForms ) {
$listPath = $listFm.ServerRelativeUrl
if ( $listPath -like '*displayifs.aspx' ) {
Write-Host 'InfoPath Found in List ' $listTitle " at URL " $listUrl -ForegroundColor Green
}
}
}
}
}
}
}
}
Source:
Get the list of all available InfoPath forms in a SharePoint Site Collection - SharePoint Online
OR
We can execute the below PowerShell script in your source SharePoint on-premise environment to get all InfoPath form details:
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue
#Configuration parameters
$WebAppURL="https://intranet.crescent.com"
$ReportOutput="C:\InfoPath-ListForms.csv"
#Array to Hold Result - PSObjects
$ResultColl = @()
#Get All Webs of the Web Application
$WebsColl = Get-SPWebApplication $WebAppURL | Get-SPSite -Limit All | Get-SPWeb -Limit All
#Iterate through each web
Foreach($Web in $WebsColl)
{
#Get All Lists with InfoPath List Forms in use
Foreach ($List in $web.Lists | Where { $_.ContentTypes[0].ResourceFolder.Properties["_ipfs_infopathenabled"]})
{
Write-Host "Found an InfoPath Form at: $($Web.URL), $($List.Title)"
$Result = new-object PSObject
$Result | add-member -membertype NoteProperty -name "Site URL" -Value $web.Url
$Result | add-member -membertype NoteProperty -name "List Name" -Value $List.Title
$Result | add-member -membertype NoteProperty -name "List URL" -Value "$($Web.Url)/$($List.RootFolder.Url)"
$Result | add-member -membertype NoteProperty -name "Template" -Value $list.ContentTypes[0].ResourceFolder.Properties["_ipfs_solutionName"]
$ResultColl += $Result
}
}
#Export Results to a CSV File
$ResultColl | Export-csv $ReportOutput -notypeinformation
Write-Host "InfoPath Lists Forms Report has been Generated!" -f Green
Note:
- After exporting the report - you can replace your on-premise site URL with SharePoint online site URL - so that we can identify that these lists contain InfoPath form template.
Source:
Find All InfoPath List Forms in SharePoint using PowerShell