I have a custom content type and I added this content type to a list. I now want this list to only use the custom content type and I want to remove the built-in "Item" content type.
I tried
$spHeaderList.ContentTypesEnabled = $true
$spHeaderList.ContentTypes.Delete($spItemContentTypeId)
$spHeaderList.Update()
I used $spItemContentTypeId
as 0x01 and as
$ItemID = [Microsoft.SharePoint.SPBuiltInContentTypeId]::Item
$spItemContentType = $spWeb.ContentTypes[$ItemID]
but still could not get it to work. I always get the error message that
"Cannot convert null to type "Microsoft.SharePoint.SPContentTypeId"
Any clues?
I am using SP2010