Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Current »

Script

Name

Description

Last Modified Date

Download

ExportFields

Exports site fields based on a group

29/01/2012

None

#	Exports fields to a csv
param 
(
	$SiteCollectionUrl = "http://localhost",
	$GroupName =  "Custom Fields",
 	$outFileName = "FieldExport.csv"
)
cls
$site = Get-SPSite $SiteCollectionUrl -ErrorAction:Stop
echo "Processing..."
$fields = $site.RootWeb.Fields | where { $_.Group -like $GroupName }
if($fields.Count -eq 0)
{
	Write-Host "Cannot find any fields for $GroupName"
	return
}
#Header
"InternalName,Title,Id,MaxLength,Description,Group,TypeShortDescription" | Out-File $outFileName
ForEach ($id in $fields)
{
 	'"' + $id.InternalName + `
 	'","' + $id.Title + `
 	'","' + $id.Id + `
 	'","' + $id.MaxLength + `
 	'","' + $id.Description + `
 	'","' + $id.Group + `
 	'","' + $id.TypeShortDescription + `
 	'"' | Out-File $outFileName -append
}
$site.Dispose()
echo "Export complete"

  • No labels