Remove SharePoint assets deployed as part of SharePoint Framework solution

This post is a contribution from Aravinda Devagiri, an engineer with the SharePoint Developer Support team

SharePoint assets can be provisioned as part of the SharePoint Framework solution and are deployed to SharePoint sites when the solution is installed on it. You can follow the article on how to provision assets as part of SharePoint Framework solution.
/en-us/sharepoint/dev/spfx/web-parts/get-started/provision-sp-assets-from-package.

The following SharePoint assets can be provisioned along with your client-side solution package:

  • Fields
  • Content types
  • List instances
  • List instances with custom schema

I had to work on a case where these assets had to be removed on uninstalling the package, but we still see that the Content Types remained in the site. When tried to delete the Content Types, we get the below error.

The solution package uses SharePoint Features to package and provision the SharePoint items. When you navigate to the Site feature, you will find the feature activated which provisioned these assets. To remove the assets, we must deactivate this feature, this should remove the fields and content types provisioned.

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.