SOLVED

Can't delete content types?

Brass Contributor

I on Content Type Hub,

I can't delete some content types. These Content Types used in some List Templates I create.

I deleted all these template already, and every list, every content type relate to this Content Type. But this still not working?

Can anybody help?

11 Replies
Have you also removed everything from your site's recycle bin (both stages)?

@Paul Pascha 

Yes. I remove all of the things related to these content types. But it's not working.

Do you get an error message stating the content type is still in use?

@Paul Pascha 

Yes. And I attempt to find anything relate these content type. But I don't know what I'm missing.

Screen Shot 2019-07-30 at 7.26.00 PM.png

best response confirmed by ca_rem (Brass Contributor)
Solution
I ran into this error quite a lot and every time I forgot to empty my Recycle Bin, especially forgot to look at the "Deleted from end user Recycle Bin" view which is only available to you if you are a Site Collection Administrator...

You said you're on you Content Type Hub. Have you published the Content Types in question? If so, you could try to Unpublish them first (in my experience this shouldn't really matter though and I just tried on the site I've helped you with earlier...)

@Paul Pascha 

Yes, I have published these content types before.

But I unpublish and remove all the other content types easily, but only 4 content types I use in List templates that can't be deleted.

By the way, I have a question. When you upload the list template to another site, can this site receive the content Type go with the template automatically? (the content type haven't existed on the site before)

The Content Type is not part of your List Template so you have to make sure the Content Type is available on sites where you want to create lists based on your template.

What mechanism are you using to make your List Templates available? Are you using a Sandboxed Solution for this? If so, you'll typically also include the Content Type definition in this solution.

@Paul Pascha ,

What mechanism are you using to make your List Templates available? Are you using a Sandboxed Solution for this? If so, you'll typically also include the Content Type definition in this solution.

I only use Saving list template in List Setting. And import and export these template via Web Designer Galleries -> List Template, that is the only way I know until now.

Sandbox Solution is the method using code, right? If you have an official blog or topic about this, please share with me.


@Paul Pascha wrote:
The Content Type is not part of your List Template so you have to make sure the Content Type is available on sites where you want to create lists based on your template.

You mean, if I don't have the content type already on my site, I can't Upload or Using these Templates?

@Paul Pascha 

I got it. Thank you. I can't see the second Stage of Recycle Bin as you said. Sr.

Thank you very much.

But relate to this topic, I wonder how we can find:

- Lists relating to a specific Content-Type, so we can easily find these Lists and remove them before we remove the Content-Type

- Content-Types relating to a specific Column, so we can easily find these Content-Type and remove them before we can remove the Column

I totally agree. There used to be ways to discover this using server-side API's but these are not available in SharePoint Online...

For M365 group sites, you will need to have scripting enabled at the tenant level. It might take up to 24 hours to take effect. If after doing so you still can't delete content types or template files within, you might need to turn on scripting on the specific site. Here's the MS article describing how to do so.

 

Here's the PowerShell scrip for quick reference:

Set-SPOSite <SiteURL> -DenyAddAndCustomizePages 0

 

Or for PnP.PowerShell

Set-PnPSite <SiteURL> -NoScriptSite $false

 

1 best response

Accepted Solutions
best response confirmed by ca_rem (Brass Contributor)
Solution
I ran into this error quite a lot and every time I forgot to empty my Recycle Bin, especially forgot to look at the "Deleted from end user Recycle Bin" view which is only available to you if you are a Site Collection Administrator...

You said you're on you Content Type Hub. Have you published the Content Types in question? If so, you could try to Unpublish them first (in my experience this shouldn't really matter though and I just tried on the site I've helped you with earlier...)

View solution in original post