0

Is there a way for us to find the list of lists/libraries that use Infopath forms in a SharePoint site?

1 Answer 1

1

Yes, we can.

Using the below PowerShell script, we can get all infopath forms from a particular web application and this report will be exported to a csv file.

[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint") > $null 

function global:Get-SPSite($url){ 

    return new-Object Microsoft.SharePoint.SPSite($url) 

} 

#Get the web application 

$WebAppURL= "<Web Application URL>" 

$SiteColletion = Get-SPSite($WebAppURL) 

$WebApp = $SiteColletion.WebApplication 



#Write the CSV header 

"Site Collection `t Site `t List Name `t List Url `t Docs Count `t Last Modified `t WF Count `t Live WF `t Live WF Names `t Form Template" > c:\temp\InfoPathLibs.csv 



#Loop through all site collections of the web app 

    foreach ($site in $WebApp.Sites) 

    { 

       # get the collection of webs 

       foreach($web in $site.AllWebs) 

        { 

            write-host "Scaning Site" $web.title "@" $web.URL 

               foreach($list in $web.lists) 

               { 

                   if( $list.BaseType -eq "DocumentLibrary" -and $list.BaseTemplate -eq "XMLForm") 

       { 

                  $listModDate = $list.LastItemModifiedDate.ToShortDateString() 

                $listTemplate = $list.ServerRelativeDocumentTemplateUrl 

                  $listWorkflowCount = $list.WorkflowAssociations.Count 

                $listLiveWorkflowCount = 0 

                $listLiveWorkflows = "" 



                foreach ($wf in $list.WorkflowAssociations) 

        { 

                    if ($wf.Enabled) 

         { 

                        $listLiveWorkflowCount++ 

                        if ($listLiveWorkflows.Length -gt 0) 

         { 

                            $listLiveWorkflows = "$listLiveWorkflows, $($wf.Name)" 

                        } 

                        else  

         { 

                            $listLiveWorkflows = $wf.Name 

                        } 

                     } 

                 } 

       #Write data to CSV File 

                   $site.RootWeb.Title +"`t" + $web.Title +"`t" + $list.title +"`t" + $Web.Url + "/" + $List.RootFolder.Url  +"`t" + $list.ItemCount +"`t" + $listModDate +"`t"  

+ $listWorkflowCount +"`t" + $listLiveWorkflowCount +"`t" + $listLiveWorkflows +"`t" + $listTemplate >> c:\temp\InfoPathLibs.csv 

             } 

               } 

        } 

    } 



#Dispose of the site object 

$siteColletion.Dispose() 

Write-host  "Report Generated at c:\temp\InfoPathLibs.csv" -foregroundcolor green 

Note:

In the above code $list.BaseTemplate -eq "XMLForm" indicates that this list has been modified in infopath form or type of infopath form.

Reference URL:

Find all lists that have an InfoPath form

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.