Get Content Type ID of SharePoint List via PowerShell and OOTB

In this hint, I will show How to Get Content Type ID of SharePoint 2013 List Via PowerShell and OOTB.

Scenario:

If you tried to create a custom action for a specific list via Visual Studio 2013 in SharePoint 2013, you will need to create a custom site content type for this list then get its ID.Custom Action list for a Content Type

In this case, You have two options to get the Get Content Type ID.

  1. Via OOTB.
  2. Via PowerShell cmdlet.

1. Via OOTB.

  • Open the custom list that has the content type.
  • Go to List Settings. (Make sure that the content types has been allowed).
    • Advanced Settings > Allow management of content types.allow management of content types
  • Below Content Types Click on your Content Type.

Content types list

  • Here you can get the List Content Type.

http://RootSite/_layouts/15/ManageContentType.aspx?List=%7B9BFE9A3B%2DB7F8%2D4A61%2D8088%2D104DD333BEB7%7D &ctype=0x0100E076A4E49D4B5D47BDF993EC507AE0020049781978ADA96741B13B3D112904E4B5

List Content Type

  • Click On Parent to get the Site Content Type.

http://RootSite/_layouts/15/ManageContentType.aspx?ctype=0x0100E076A4E49D4B5D47BDF993EC507AE002

site content type

2. Via PowerShell

  • Open SharePoint Management Shell as Administrator.

Run SharePoint Management Shell as Administrator - Devoworx

  • Write the following cmdlet to

Show all Content Type within a specific website.

$site = Get-SPSite -Identity http://RootSite/
$web = $site.OpenWeb("YourSite")
ForEach($ctype in $web.ContentTypes){write-host $ctype.Name": "$ctype.ID}

OutPut :

CustomActionCT : 0x0100E076A4E49D4B5D47BDF993EC507AE002

Get All Content Type ID via PowerShell

Show a specific Content Type within a specific website.

$site = Get-SPSite -Identity http://epm/
$web = $site.OpenWeb("workflow")
ForEach($ctype in $web.ContentTypes){write-host $ctype.Name": "$ctype.ID | Where-Object {$ctype.Name -eq 'CustomActionCT'}}

OutPut :

CustomActionCT : 0x0100E076A4E49D4B5D47BDF993EC507AE002

Get Content Type ID via PowerShell
Enjoy 🙂

**Please don’t hesitate to ask for any clarifications at comments.

Advertisements

One thought on “Get Content Type ID of SharePoint List via PowerShell and OOTB

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s