Here is the powershell script to retrieve all Site Columns for a SharePoint 2010 site collection and output the details into a .csv file
Copy the code below and change the Site Collection URL and Output Path as per your requirement, save the following as .ps1 file:
Add-PsSnapin Microsoft.SharePoint.PowerShell
## SharePoint DLL
[void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint")
# Description
# Output all available Column Field GUIDs to AllColumnFields.csv
# Settings Start
set-variable -option constant -name url -value "http://localhost" # Site collection
set-variable -option constant -name out -value "C:AllColumnFields.csv" # Output file
# Settings End
$site = new-object Microsoft.SharePoint.SPSite($url)
$web = $site.rootweb.Fields
echo "Generating File..."
ForEach ($id in $web)
{
'"' + $id.Title + `
'","' + $id.Id + `
'","' + $id.InternalName + `
'","' + $id.StaticName + `
'","' + $id.MaxLength + `
'","' + $id.Description + `
'","' + $id.Group + `
'","' + $id.TypeShortDescription + `
'"' | Out-File $out -append
}
$site.Dispose()
echo "Finished"
echo "File created at : " $out
Remove-PsSnapin Microsoft.SharePoint.PowerShell
It outputs all the Site Column details available in the Site Columns Gallery to a .csv file.
Copy the code below and change the Site Collection URL and Output Path as per your requirement, save the following as .ps1 file:
Add-PsSnapin Microsoft.SharePoint.PowerShell
## SharePoint DLL
[void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint")
# Description
# Output all available Column Field GUIDs to AllColumnFields.csv
# Settings Start
set-variable -option constant -name url -value "http://localhost" # Site collection
set-variable -option constant -name out -value "C:AllColumnFields.csv" # Output file
# Settings End
$site = new-object Microsoft.SharePoint.SPSite($url)
$web = $site.rootweb.Fields
echo "Generating File..."
ForEach ($id in $web)
{
'"' + $id.Title + `
'","' + $id.Id + `
'","' + $id.InternalName + `
'","' + $id.StaticName + `
'","' + $id.MaxLength + `
'","' + $id.Description + `
'","' + $id.Group + `
'","' + $id.TypeShortDescription + `
'"' | Out-File $out -append
}
$site.Dispose()
echo "Finished"
echo "File created at : " $out
Remove-PsSnapin Microsoft.SharePoint.PowerShell
It outputs all the Site Column details available in the Site Columns Gallery to a .csv file.