I need to get the names of all the lists using specific site columns. I've got the following code

$web = Get-SPWeb "http://nameofsite/sites/subsite"
$filePath = "E:\lists.txt"
$array = "array of site column names"

foreach ($element in $array)
  $column = $web.Fields[$element]
  $column.ListsFieldUsedIn() | Out- File -FilePath $filePath -Append


ListsFieldUsedIn() is returning the web id and list id in each web id. Is there any way to get the list of names based on the list id that is returned? This would make it easier to identify the lists. Thanks!


I ended up doing this:

$site = Get-SPSite "http://nameofsite/sites/subsite"
$filePath = "E:\lists.txt"
$array = "array of site column names"    
 $column = $site.RootWeb.AvailableFields[$element]
 $lists = $column.ListsFieldUsedIn()
 $column.ListsFieldUsedIn() | ForEach-Object {
  $w = $site.AllWebs[$_.WebID]
  $l = $w.Lists[$_.ListID]
 "Web:" +$w.Title+ "  List: " + $l.Title+ " ListUrl: " +$l.RootFolder.Url |      Out-File -FilePath $filePath -Append 


Based on code I found here sharepoint.stackexchange.com

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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