Monday, March 27, 2017

Get Details of all fields associated with SharePoint List

$site = new-object Microsoft.SharePoint.SPSite("http://<Site URL>") #Change site URL#
    $web = $site.openweb()
    $list = $web.Lists["<List Name>"] #Get Field Details for specified list
   
    Write-Host "List Name: " $list.Title  ##Print List title
    Write-Host "------------------------------------------------------"
    Write-Host "Field Name | Field Title "
    Write-Host "------------------------------------------------------"        
   
    foreach ($field in $list.Fields) #Get all views in lists
    {
        Write-Host $field.Title " | " $field.Type -ForegroundColor Green #Write out each field (column)                        
       
    }  
    Write-Host "------------------------------------------------------"
    Write-Host " "

    $web.Dispose()
    $site.Dispose()

No comments:

Post a Comment