当前位置:网站首页 > 更多 > 玩电脑 > 正文

[玩转系统] 使用 PowerShell 查找 SharePoint 中的所有 InfoPath 列表表单

作者:精品下载站 日期:2024-12-14 14:09:39 浏览:13 分类:玩电脑

使用 PowerShell 查找 SharePoint 中的所有 InfoPath 列表表单


要求:在 SharePoint 中查找所有自定义 InfoPath 列表表单。任务是报告迁移项目期间在 SharePoint Web 应用程序中自定义的所有 InfoPath 列表表单的列表。

用于查找 SharePoint 中所有 InfoPath 列表表单的 PowerShell 脚本

随着 SharePoint 2016 和 Office 365 中 InfoPath 的弃用,我们希望找到在 SharePoint 环境中使用 InfoPath 表单自定义的所有列表。在这篇博文中,我们将向您展示如何使用 PowerShell 查找 SharePoint 网站集中的所有 InfoPath 列表表单。


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

该脚本生成一个 CSV 输出报告,如下所示:

[玩转系统] 使用 PowerShell 查找 SharePoint 中的所有 InfoPath 列表表单

相关文章:查找 SharePoint 中的所有 InfoPath 表单库

您需要 登录账户 后才能发表评论

取消回复欢迎 发表评论:

关灯