PowerShell – How to enumerate List / Libr. Properties

Sometimes you want to get some list or library properties for whatever reason.

In my case I needed it to document the SP application we built.

This Example exports field properties like Description to Excel

CLS 
[system.reflection.assembly]::loadwithpartialname("microsoft.sharepoint")

$URL = "http://YourServer/"
$Lib = "HelpDesk"
$Out = "D:\temp\"

$site= New-Object Microsoft.SharePoint.SPSite ($URL)

$web=$site.OpenWeb()

$list=$web.Lists[$Lib]  
write-host ""
#$list | Select Title, Description  
write-host ""
write-host "Records : " $list.ItemCount
write-host ""
$list.Fields | select parentlist, ID, internalname, title,  `
   Description, CanBeDeleted, Required, Hidden, Group `
 | where {$_.group -eq "Custom Columns" -and $_.CanBeDeleted -eq `
   $false -and $_.Hidden -eq $false -or $_.Required -eq $true} `
 | Sort-Object title | Export-CSV ($Out + $Lib + ".csv")

Enjoy !!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: