Display Lists & Libraries That Use a Specific Content Type in SharePoint 2010

SharePoint content types encapsulate data requirements, enable content standardization, and are independent of file formats which makes them popular to use across SharePoint. Fast forward to a few hundred content types used within a large SharePoint environment and you’ll soon need to pay attention to managing these content types and answering question such as how many custom content types do we have and where are they being used.

A specific scenario this post addresses is the need to report on a specific content type use within a site collection. The video and script below highlight the process you’d need to take to generate such a report.

Video length: 2:24 min

To list a specific content type usage within a site collection copy and paste the following script into the SharePoint 2010 Management Shell.

Note: Two things to change: 1. The site collection address and 2. The content type name

 $webs = get-spsite http://sharepoint2010/sites/portal14| get-spwebforeach ($web in $webs)

foreach ($lst in $web.lists)  
{    
foreach ($ctype in $lst.ContentTypes)    
{      
if ($ctype.Name -eq “Document”)      
{ $lst.DefaultViewUrl
}   

}  
$web.Dispose()
}

 

Leave a Comment