Find All Lists And Libraries Using Infopath In SharePoint

This article explains how to find out all the lists and libraries using InfoPath form in SharePoint using PowerShell.

InfoPath is one of the most popular and widely used forms design and development solution that developers and IT consultants use alike, primarily across on-premise versions. However, there are no direct out-of-the-box means of identifying lists/libraries using InfoPath.

Once again, PowerShell comes to the rescue. Using a simple PowerShell, we can easily identify the lists/libraries using InfoPath Forms. We can extend it and generate a report out of it as well.

This script can identify all the lists and libraries that use InfoPath. This can be useful for scenarios like -

  • Identify lists using InfoPath to consider them for replacement with other solutions like Nintex Forms, K2 SmartForms, etc.
  • Convert/Re-engineer InfoPath forms to PowerApps
  • Generate a report containing lists using InfoPath form, and replace them with CSOM designs
  • User Profile service embedded in InfoPath works differently in SharePoint 2016 than that of SharePoint 2010. A report of all InfoPath enabled list/library will be beneficial to perform the fix.

The Script

  1. #########################################  
  2. #### Infopath Usage Identifier       ####  
  3. #### Scope - Site Collection         ####  
  4. #### Input - Site Collection URL     ####  
  5. #########################################  
  6.   
  7.    
  8. $siteCollectionURL =  "http://sharepoint.devbox.com/sites/mysitecollection"  
  9.   
  10. if((Get-PSSnapin | Where {$_.Name -eq "Microsoft.SharePoint.PowerShell"}) -eq $null)  
  11. {  
  12.     Add-PSSnapin Microsoft.SharePoint.PowerShell;  
  13. }  
  14.   
  15. try  
  16. {  
  17.     $mySite = Get-SPSite -Identity $siteCollectionURL  
  18.     $myWebs = Get-SPWeb -Site $mySite -Limit All  
  19.    
  20.     $results = @()  
  21.     foreach ($myWeb in $myWebs)  
  22.     {  
  23.         Write-Host "Looking in WEB: "  $myWeb.Url -ForegroundColor Green  
  24.         foreach ($myList in $myWeb.Lists)  
  25.         {  
  26.             if ($myList.ContentTypes[0].ResourceFolder.Properties["_ipfs_infopathenabled"] -eq $true)  
  27.             {  
  28.              Write-Host "Found this list using Infopath -  " $myList.Title -ForegroundColor Blue  
  29.              $RowDetails = @{  
  30.                             "Site Collection"  = $siteCollectionURL  
  31.                             "Web"              = $myWeb  
  32.                             "List Name"        = $myList.Title  
  33.                             "List URL"         = $myList.DefaultViewUrl                              
  34.                         }  
  35.              $results += New-Object PSObject -Property $RowDetails  
  36.             }  
  37.         }  
  38.         $myFileName = [Environment]::GetFolderPath("Desktop") + "\InfopathDependencyFinder-SiteCollectionScope-" +  (Get-Date).ToString('MM-dd-yyyy') + ".csv"  
  39.         $results | export-csv -Path $myFileName -NoTypeInformation       
  40.     }   
  41.     Write-Host "---------------------Completed--------------------------" -ForegroundColor Green    
  42. }  
  43.    
  44. catch  
  45. {  
  46.     $ErrorMessage = $_.Exception.Message  
  47.     Write-Host $ErrorMessage  
  48. }  

The key here is the line below,

  1. $myList.ContentTypes[0].ResourceFolder.Properties["_ipfs_infopathenabled"] -eq $true  

This snippet above checks if the Content Type’s Resource Folder metadata has the InfoPath property – InfoPath Forms Services (_ipfs_infopathenabled) activated on it.

This script runs against site collection, but it can be very easily extended to run across subsite level or even list/library level.

Usage

The script returns the InfoPath lists/libraries below details

  • Site,
  • Web,
  • List/Library Name,
  • List/Library URL where the form is deployed

The output is in the form of a CSV file which can be very easily be converted into a .xlsx file for further processing and reporting.

Here is a screenshot of a sample report,

Find All Lists And Libraries Using Infopath In SharePoint

The code snippets can be found in my GitHub repo as well.

Thanks for reading!