sp-dev-docs icon indicating copy to clipboard operation
sp-dev-docs copied to clipboard

Delete Provisioned Content Type

Open zolem opened this issue 8 years ago • 7 comments

Category

  • [x] Question
  • [ ] Typo
  • [ ] Bug
  • [ ] Additional article idea

Expected or Desired Behavior

Provisioned content types should allow deletion

Observed Behavior

Attempting to delete a content type that has been provisioned by an spfx webpart will give you an error. It usually says something like: This content is associated with a feature so it can't be deleted. To get around this I have created a horde of content types: image

Now it gives me errors about duplicate content types when I try to delete them which may actually be true for some, but at some point I started using a new unique guid every time.

Question

Is there a way to delete content types provisioned from an SPFX webpart? Would be nice to clean this up and not have to create a new one every time I screw up and have to try again.

Steps to Reproduce

Just provision a content type with an SPFX webpart. Remove everything associated with it and then try to delete it. It will give you an error of one of the following:

  • Duplicate content type sometimes (after doing my workaround above, even when trying to delete one with a unique guid)
  • Associated with a feature so can't be deleted (not sure if you can delete a feature if deleting the app doesn't do it)

zolem avatar Oct 11 '18 16:10 zolem

Please try to empty the secondary recycle bin in the admin site after you’ve deleted everything that associated with your content type. Then delete this content type.

KingKangMSFT avatar Oct 30 '18 02:10 KingKangMSFT

@KingKangMSFT I have done that many, many times. Still no dice.

zolem avatar Nov 02 '18 15:11 zolem

I am having the same experience

From the tutorial here https://docs.microsoft.com/en-us/sharepoint/dev/spfx/web-parts/get-started/provision-sp-assets-from-package

Observed Behavior

Fields get added to the content type Fields get added to list The content type does not get added to the list. New content type is unable to be removed. Tried manually through the browser and Remove-PNPContentType and even "-Force" Error message received "The content type "Cost Center" is part of an application feature" Removed the "asset-development-client-side..." App from the site. Clear-PnPRecycleBinItem Tried to delete again. Got the same error. Removed the app from the tenant app catalog. Clear-PnPRecycleBinItem on the app catalog site Tried to delete again. Got the same error.

khmlpa avatar Nov 09 '18 07:11 khmlpa

This is unfortunately currently by design. There's no way to delete a content type, which had some content at some point and which was created using a Feature Framework feature, which has been already de-activated. This is by design since SP2007 unfortunately.

VesaJuvonen avatar Nov 20 '18 18:11 VesaJuvonen

Are there any workarounds to accomplish this? Its been suggested that "If you don't have the feature anymore, create dummy feature, with fake CT - put the right content type ID and Name, other attributes doesn't matter, even the FieldRefs node doesn't matter."

OR

https://blogs.technet.microsoft.com/sharepointdevelopersupport/2018/07/17/remove-sharepoint-assets-deployed-as-part-of-sharepoint-framework-solution/ Here is the order on how to remove assets deployed as part of SharePoint Framework package.

Remove the list from the site contents. Delete them from the recycle bin, both from the first stage and second stage recycle bin. Browse to "Site Settings" --> "Manage site features" --> Deactivate the custom feature that is installed through package and provisioned the assets. You should find that the content types are removed for the Site content types. You can remove the app without any issue and without any assets remaining in the site.

mjmohitjoshi avatar Jun 10 '19 07:06 mjmohitjoshi

@mohitcreative - those are indeed valid workarounds on cleaning things up, if needed.

VesaJuvonen avatar Jun 10 '19 12:06 VesaJuvonen

Issues that have been closed & had no follow-up activity for at least 7 days are automatically locked. Please refer to our wiki for more details, including how to remediate this action if you feel this was done prematurely or in error: Issue List: Our approach to locked issues

msft-github-bot avatar Jan 26 '20 06:01 msft-github-bot