One day the 
site content types got stuck and would not budge from a site. We cursed, begged and clicked a hundred times - none of these would get the desired result. We tried hitting the PC box harder but somehow it also didn't bring any improvement. The first hurt so actually the situation changed for the worse.


We did the Thinker pose, shouted loudly %#$%#% (still no improvement) and resorted to something that almost never fails - PowerShell.

To save you from hurting your fists, we are sharing the solution below:

We have already PowerShell ISE and SharePoint Online SDK installed. So in the ISE Window let's go right away and add the paths to the SDK:

Add-Type -Path "c:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.dll"
Add-Type -Path "c:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.Runtime.dll"

Enter the data of the site:

$AdminPassword=Read-Host -Prompt "Password" -AsSecureString

and the content type id.

How to find the content type id?

1. Navigate to Site>Site settings > Content types


Enter the URL of the site where you want to remove the content type. At the end of the URL add /_layouts/15/mngctype.aspx 

At the end of step 1, you should have:

2. Click on the content type you want to remove.

3. In the browser's URL bar you will see something like:

The numbers marked in red are the id of the content type (not the same as the GUID). More reading content type id: Content Type IDs
This content type id is:


The function itself:

function Remove-Contenttype
param (
#$password = ConvertTo-SecureString -string $AdminPassword -AsPlainText -Force
  $ctx=New-Object Microsoft.SharePoint.Client.ClientContext($Url)
  $ctx.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Username, $AdminPassword)
Write-Host $ctx.Web.Url $ct.Count.ToString()


All that remains is to run the cmdlet (still in the .ps1 file!)

Remove-Contenttype -Username $Username -AdminPassword $AdminPassword -Url $AdminUrl -ContentTypeID $ContentTypeID

The full script can be downloaded 

Run the script in any PowerShell. It should ask you for your admin password.


Some of the content types were removed in the first go (Yey!). Additionally received the site URL from where they were removed and how many content types remained (just as a security precaution).

In some of the cases, though, it failed. As a consolation we received a meaningful message from PowerShell:

"Content type MYNAME at sites/MYSITENAME is read only"

A short trip to the user interface solved the issue:

1. Site settings
2. Site content types
3. Click on the name of the content type
4. Advanced settings
5. Should this content type be read only? Well, NO

Deleted the content type from the User Interface (sorry PowerShell for betrayal...)

Fixed the issue. Bravo again for the power of PowerShell and its infinite help!

Thanks also to Mada for the inspiration.

Let's hope, dear reader, your fists have been saved :)


The script is available also for download from the TechNet Script Gallery:

Remove content type from SharePoint site using PowerShell