Deleting Site Content Types in MOSS 2007 (Content Type in use)

I have been cleaning up our intranet portal and realized that the former admin had implemented some content types. We have streamlined how we are gathering information, and also needed to add some new content types. As soon as I started trying to delete the old ones, I quickly realized that there was more going on here than I thought. Specfically, MOSS won't let you delete a content type if a document is using it. That makes sense. So I went through my library and changed all of the documents using the old content type to the new content type. This time when I tried to delete it, same error. "Content Type is in use". Started looking into it and found the following blurb from Hristo on his blog. Specifically, line 2 was the culprit. We use versioning as well as major and minor versions. Once I published a major version for these docs, I was able to remove the old content types.

"This could happen either when you are trying to delete the content type via the SharePoint GUI or from your custom code. You may be thinking that this is incorrect, however have you considered this:

1) Actually you may not see documents that are using the content type because you don’t have rights to. SharePoint 2007 has item level security settings. So check all the documents in the list with an account that has full control (e.g. site collection admin).

2) If the list allows both minor and major versions and if any of the documents in the list is a minor version, but also has an existing previous major version (i.e. published version), then SharePoint will refuse to delete the content type if it is used by this last major version, even if the latest minor version is not using it. I don’t have an explanation about why it is doing it, but this is how it works. It seems that you will need to check in a major version if you want to remove the content type in this case.

3) If the list has the ForceCheckOut flag enabled, then someone may have just added a document and may have not yet pressed “Check In” or may have pressed “Cancel” on the EditForm page. In such a case the document will be added to the list with version 0.1 but will be checked out to that user and will not show up for anyone else (including site collection admins). Actually even if you check through code the SPList.Items with elevated privileges account you will still not be able to see this item if it is not checked out to the elevated account."

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.
  • You may use [inline:xx] tags to display uploaded files or images inline.

More information about formatting options