SharePoint Online: Get List Content Types using PowerShell

Requirement: Get All Content Types from a SharePoint Online List.

How to Get SharePoint Online List Content Types?

Content types in SharePoint Online define the metadata, workflows, and behaviors associated with a particular type of content, such as list items and documents. Are you looking for a way to get content types from a SharePoint Online list? If so, PowerShell is the answer. This blog post will show you how to use PowerShell to easily retrieve a list of content types associated with a SharePoint Online list or document library.

To get all content types of a SharePoint List or library,

  1. Navigate to the list or document library in the browser
  2. Click on Setting gear >> Choose “List Settings”
  3. You’ll find all list content types on the List settings page under the “Content Types” section.
    SharePoint Online Get List Content Types using PowerShell

SharePoint Online: PowerShell to Get List Content Types

Here is the PowerShell to get a list of content types in the SharePoint Online list:

#Load SharePoint CSOM Assemblies
Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.dll"
Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.Runtime.dll"
#Set parameter values

#Get Credentials to connect
$Cred= Get-Credential
#Setup the context
$Ctx = New-Object Microsoft.SharePoint.Client.ClientContext($SiteURL)
$Ctx.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Cred.Username, $Cred.Password)
#Get the List
$List = $Ctx.Web.lists.GetByTitle($ListName)

#Get All content types of the list
$ContentTypes = $List.ContentTypes

#Get Content Type Details
$ContentTypes | Select Name,Description, Group, ID

This script will retrieve all content types from your SharePoint Online list and display their name, description, group, and IDs. Here is the output:

sharepoint online powershell get list content types

Similarly, to get content types from a SharePoint Online list using PnP PowerShell, use:

$SiteURL = ""
$ListName = "Projects"
$ContentTypeName = "Crescent Projects V2"

#Connect to PnP Online
Connect-PnPOnline -Url $SiteURL -Interactive

#Get all content types from list
$ListContentTypes = Get-PnPContentType -list $ListName
$ListContentTypes | Select Name, ID

#To get a specific content type from a list, use:
$ListContentType = Get-PnPContentType -list $ListName -Identity $ContentTypeName

To get content types of all lists in SharePoint Online, use: SharePoint Online: Get Content Type usage using PowerShell

Salaudeen Rajack

Salaudeen Rajack - Information Technology Expert with Two-decades of hands-on experience, specializing in SharePoint, PowerShell, Microsoft 365, and related products. He has held various positions including SharePoint Architect, Administrator, Developer and consultant, has helped many organizations to implement and optimize SharePoint solutions. Known for his deep technical expertise, He's passionate about sharing the knowledge and insights to help others, through the real-world articles!

Leave a Reply

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