Thursday, September 3, 2015

Get all fields inside ContentType sharepoint powershell


cls
set-variable -option constant -name url -value "http://siteurl"  # Site collection
#set-variable -option constant -name out -value "ContentTypes.csv"  # Site collection
# End of settings

$site = new-object Microsoft.SharePoint.SPSite($url)
$cts = $site.rootweb.ContentTypes["ContentTypeName"]


ForEach ($id in $cts)
{
  ForEach ($field in $id.Fields)
  {
  Write-Host $field.Title
  Write-Host $field.InternalName
 
  }
}

$site.Dispose()

echo "Finished!"

No comments:

Post a Comment