Programmatically reset a a Sitecore Item’s presentation details

Just a quick post – should you need to reset an item back to using the controls defined on its template’s standard values, you can easily achieve this through code:

using (new Sitecore.SecurityModel.SecurityDisabler())
{
using (new Sitecore.Data.Items.EditContext(item))
{
item.Fields["__renderings"].Reset();
}
}

I’ve tried it, and it worked.

Advertisement
Programmatically reset a a Sitecore Item’s presentation details

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.