Mindy Kelly

I can't delete a content type from a document library in MOSS.
Using the GUI to delete a content type from a document library gives:

Content Type is still in use

I have verified that all documents are assigned to a different content type 
and I've poked around in the content database, but it doesn't look simple.

Please help!
Thanks,
Mindy


Re: SharePoint - Setup, Upgrade, Administration and Operation Deleting Content Types

Curtis Ruppe

Hey Mindy,

The following T-SQL is not supported by anyone of note (as I just created it). You should not use this to reverse engineer the content type process as I may be forgetting some very important link. Please do feel free to use this T-SQL to find dependencies of this content type. Since content types can be inherited, you may find that even though no list is using a content type, you still won't be able to delete it until you delete its child content types. Be sure to replace 'Document' with the name of the content type you wish to look for.

Code Snippet

DECLARE @ContentTypeName nvarchar(128)

SET @ContentTypeName='Document'

SELECT w.Title AS [Web Site], w.FullUrl AS [Web Url], al.tp_Title AS [List Title], ct2.* FROM ContentTypes ct1 JOIN ContentTypes ct2 ON LEFT(ct2.ContentTypeId, Len(ct1.ContentTypeId))=ct1.ContentTypeId LEFT OUTER JOIN dbo.ContentTypeUsage ctu ON LEFT(ctu.ContentTypeId, Len(ct2.ContentTypeId)) = ct2.ContentTypeId LEFT OUTER JOIN dbo.AllLists al ON ctu.ListId = al.tp_Id AND ctu.WebId=al.tp_WebId LEFT OUTER JOIN dbo.Webs w ON al.tp_WebId = w.Id WHERE ct1.ResourceDir=@ContentTypeName





Re: SharePoint - Setup, Upgrade, Administration and Operation Deleting Content Types

Mindy Kelly

Hi Curtis,

This is fantastic for finding where a content type is used across the board - thank you!

I ran this on the content type I need to get rid of, but it found nothing (I ran it on another content type and it worked just fine). I just need to delete the darn thing from a particular document library.

Thanks!

Mindy





Re: SharePoint - Setup, Upgrade, Administration and Operation Deleting Content Types

Purse

Mindy,

Make sure that content type isn't associated w/ any lists. Just b/c you don't have any documents of that content type doesn't mean the content type isn't in use. I has a similar issue and was able to resolve it by deleting the list the content type was associated w/. I assume you could simply change the settings on the list just as well.

P





Re: SharePoint - Setup, Upgrade, Administration and Operation Deleting Content Types

Mindy Kelly

Hi Purse,

The problem is that I need to delete the content type just from one document library (list). The GUI will not allow me to do it and says that the content type is in use (within the doc library). It is not in use in any visible manner.

Thanks,
Mindy





Re: SharePoint - Setup, Upgrade, Administration and Operation Deleting Content Types

Curtis Ruppe

Hey Mindy,

Upon reading your original post, I realized I overshot your original question. Although I don't have a fantastic solution for you at this time, let me at least make you did the minimal steps for deleting a content type within a list.

After modifying all documents within the document library to not use the content type, did you verify that the existing content type you want to delete is not the default content type Also, once that has been changed, have you tried to disable content type management Just some food for thought.





Re: SharePoint - Setup, Upgrade, Administration and Operation Deleting Content Types

Mindy Kelly

Hi Curtis,

Yes, I did all of that. I did not disable content type management however, because I need the other content types. Are you suggesting to disable and then re-enable

Thanks,

Mindy





Re: SharePoint - Setup, Upgrade, Administration and Operation Deleting Content Types

Curtis Ruppe

Yes, disable, delete, then re-enable. There is a slight chance you will be able to delete it. Also, check the C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\LOGS directory and look for the latest computername / timestamp log entry. See if you can find any more information regarding the deletion of the content type in that log.



Re: SharePoint - Setup, Upgrade, Administration and Operation Deleting Content Types

Mindy Kelly

Well, you can't delete a content type when management is disabled. But I disabled, re-enabled, and still could not delete.

There is nothing in the logs with regard to the attempt to delete the content type. Do you happen to know which diagnosic logging category reports on content type activities

Thanks,

MIndy





Re: SharePoint - Setup, Upgrade, Administration and Operation Deleting Content Types

Curtis Ruppe

The log would have the content type or some part of the error message you see in it. How about creating a network place to the document library in question, perform a copy & paste operation into a regular Windows OS folder (possibly your desktop), delete the documents from the document library, and then try to delete the content type. If nothing else, you should be able to delete the document library and re-create it. Then add your documents back in once you have the updated / recreated document library in place. Assign the content types to each document as appropriate. Caution, this will delete all SharePoint-specific metadata (to including versioning) from the documents.



Re: SharePoint - Setup, Upgrade, Administration and Operation Deleting Content Types

Mindy Kelly

I thought about doing that, but I'm trying to avoid it as it would be a lot of work and we would have to sacrifice important metadata and versions. Maybe when Syntergy's Copy and Paste is released...

Mindy





Re: SharePoint - Setup, Upgrade, Administration and Operation Deleting Content Types

Curtis Ruppe

I haven't forgotten about your problem, but I don't have any good ideas either. Maybe check your Recycle Bin for documents that may be attached to the ContentType you wish to delete. Whenever documents are deleted into the Recycle Bin, they should no longer be referenced anywhere, so this is a long shot. Be sure to delete the documents from the Administrative Recycle Bin as well. If this doesn't work, I really don't have any more advice to offer you. Sorry.



Re: SharePoint - Setup, Upgrade, Administration and Operation Deleting Content Types

Dangeriz

I had the exact same problem. Turns out that there were still references to the content type from the documents in the recycle bin. I emptied out the recycle bin, as well as the administrators recycle bin, did an IISRESET, and then I could successfully delete the content type. Not sure if you have trailing references to the content type anywhere else Mindy.





Re: SharePoint - Setup, Upgrade, Administration and Operation Deleting Content Types

AhmetEraslan

Hi ..

I defined a contenttype in a feature.. but you can set the guid of the contenttype and this is id sets the parent e.g.

a contenttypes parent is system page, and can that be the reason that i cant delete my contenttype