Wednesday, 6 February 2019

Get External DB List


Add-PSSnapin Microsoft.SharePoint.PowerShell
# Save in a variable the external lists you wish to report on
# in this example, the variable contains all external lists
# in a specific web application
$Lists = Get-SPWebApplication https://sitename| Select -ExpandProperty Sites | Select -ExpandProperty AllWebs | Select -ExpandProperty Lists | where {$_.hasexternaldatasource -eq $true}
# Save the expression to obtain the ECT name in a variable
$e=@{Expression={$_.DataSource.GetEntity().Name}}
# Output external lists grouped by ECT
$Lists | Sort $e | Format-Table Title, ParentWebUrl –Groupby $e

No comments:

Post a Comment