Skip to main content

Wouter

Go Search
Home
Contact Me
  

Wouter > Posts > Creating a quick overview of your content type hierarchy using PowerShell
Creating a quick overview of your content type hierarchy using PowerShell

During one of my test deployments I came across an issue where SharePoint indicates that there are duplicate 'Item' and 'Folder' content types. Ai. Sure didn't create these, so likely there is an issue with the ID hierarchy. Since typically the content types are spread out across projects you might have a difficult time debugging this. Here's a one-line PowerShell script that prints out a sorted list of the IDs and names of all content types in your Visual Studio solution (should all go on one-line)

Get-ChildItem -Recurse -Filter *.xml | %{ $content = [xml](gc $_.FullName); $content.Elements.ContentType} | Sort-Object -Property ID | Format-Table ID, Name

This gives you the following print-out. I changed the names a bit to protect my clients vested interests in their content type names

ID Name -- ---- 0x010091D0EF4228294dc78DD944DD50BDD68D MyCT
0x0100D1D64E521DBB40b98A8680B6EC81CCBD MyOtherCT
0x0100D1D64E521DBB40b98A8680B6EC81CCBD01 MyDerivedCT
0x0100D1D64E521DBB40b98A8680B6EC81CCBD0101 MyDerivedDerivedCT

Hope it helps!

Comments

There are no comments yet for this post.
Items on this list require content approval. Your submission will not appear in public views until approved by someone with proper rights. More information on content approval.

Name (required) *


Your Url

Type the Web address: (Click here to test)  

Type the description: 

Comments (required) *

Attachments