Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more
AI OnAI Off
Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more
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")
pageDefinition.Delete();
}
}
David
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 =)
Thanks your replies!
David, I took your advice and deleted the properties with the API. Your code run flawless!
Hi,
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