Udostępnij za pośrednictwem


Delete a Builtin ContentType from the list - Item, Document ... SPBuiltInContentTypeId

Hi,

In order to delete a out of the box content type from a list/Library  (item, document, etc..), you need to delete it from name as the associated Id in the list is a child of the site contentType.

When you add a site content type to a list or library, SharePoint Foundation makes local copies of any columns that are referenced by the content type and adds them to the list's fields

So to delete for example the item content type, you will need to:

SPContentTypeId ListitemContentTypeId = list.ContentTypes[web.ContentTypes[SPBuiltInContentTypeId.item].Name].Id;
list.ContentTypes.Delete(ListitemContentTypeId);

Namaste!