Content Type Summary Report Content Type Summary Report
Meet Bhimani

Meet Bhimani

September 04, 2012

All Post
Content-Type-Summary-Report
Share:

Content Type Summary Report

Sometimes I get challenged with questions as to which fields are used in which Content Types.  All too often I need to know quickly know the internal name of fields used in Content Types.  I wrote a script that generates a report that you can run to generate a CSV that can easily be Pivoted in Excel for answering such questions. I’m a huge fan of using a Content Type Syndication Hub. With all the Content Types in one location, this report becomes very useful.

 $rootwebname="http ://SharePoint"
$rootweb=Get-SPWeb $rootwebname
$MyCTSummaryCSV="L:CTSummary.CSV"
Add-Content  $MyCTSummaryCSV "CT Name,CT Group,Parent CT, CT Read-Only,CT Hidden,Field Internal Name,Field Title,Field Type,ShowInDisplayForm,ShowInEditForm,ShowInNewForm"
 
$CTs=$rootweb.contenttypes
 
for ($i=0; $i -lt $CTs.count; $i++)
{
    $CT=$CTs[$i];
    $CTName=$CT.Name;
    $Fields=$CT.Fields;
    for ($j=0; $j -lt $Fields.count; $j++)
    {
        $Field=$Fields[$j];
 
        $OutStr="$($CTName),$($CT.group),$($CT.Parent.Name),$($CT.ReadOnly),$($CT.Hidden),$($Field.staticname),$($Field.Title),$($Field.type),$($Field.ShowInDisplayForm),$($Field.ShowInEditForm),$($Field.ShowInNewForm)"
        Write-Host "." -NoNewline
        Add-Content  $MyCTSummaryCSV $OutStr
        #write-host "$($outstr)"
    }
}

Leave a Reply

Your email address will not be published. Required fields are marked *

Want to talk?

Drop us a line. We are here to answer your questions 24*7.