Try our conversational search powered by Generative AI!

How to Delete (lots of) Properties?




How can I delete properties directly in SQL? 

I know you can delete properties via the EPiServer CMS by going to EPiServer CMS -> Admin Mode -> Page Type Tab -> Select Page Type -> Select Property -> Delete. But... I want to delete 6 properties, which occur on circa 50 page types, which means a lot of clicking, waiting, and clicking again.  

I hope some has experience with deleting properties 'manually', and want to share their experience :-)


Best, Leonard

Jan 29, 2013 17:48

Hello Leonard

I would not advise trying to delete properties directly in SQL, I would advise using the API. Something like the following (I wrote this in comment so cannot guarantee this will work):

//Get all the pageTypes
foreach (var pagetype in PageType.List())
  // Loop through all properties
  foreach (var pageDefinition in pagetype.Definitions)
    if (pageDefinition.Name == "PropertyName")



Jan 29, 2013 21:02

As David said doing it in SQL isn't a prefered way but if your a lone cowboy and want to take the road less travelled I would advice to having sql profiler running and then delete a property in adminmode. This will give you the sp:s used for the command.

Oh.. and yea.. you know.. take a backup =)

Edited, Jan 30, 2013 10:20

Thanks your replies! 

David, I took your advice and deleted the properties with the API. Your code run flawless! 


Jan 30, 2013 14:12
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.