I have one page let's say "Benefit" having two fields, one is Description (textstring) and other one is selectpictures (Media). i have entered some text in description and select picture in the second one.
After doing courier, i dont want description field to be updated, but only wants images fields to be updated on target website.
In berif want some of field to be updated and few fields retains thier contents.
You will have to hook into the api, using a DataResolver, which can intercept the data, and remove property data from the collection before saving, that will avoid it from being updated.
The class handling property data is called ContentPropertyData
But i have one more query that where to write this code, as i want to retain content for all content properties.
//here we intercept the actual data and replace any unicorn mention with "horse" public override void PackagingProperty(Core.Item item, ItemProviders.ContentProperty propertyData) { //get the refence to the property data object the data is part of var properties = (ContentPropertyData)item; if (propertyData.Value.ToString() == "unicorn") propertyData.Value = "Horse"; }
So could you please suggest in which file i have to write this code.
How to retain content using courier deployment
I have one page let's say "Benefit" having two fields, one is Description (textstring) and other one is selectpictures (Media). i have entered some text in description and select picture in the second one.
After doing courier, i dont want description field to be updated, but only wants images fields to be updated on target website.
In berif want some of field to be updated and few fields retains thier contents.
You will have to hook into the api, using a DataResolver, which can intercept the data, and remove property data from the collection before saving, that will avoid it from being updated.
The class handling property data is called ContentPropertyData
Docs are here: http://nightly.umbraco.org/UmbracoCourier/Data%20Resolvers.pdf
Thanks Per Ploug,
But i have one more query that where to write this code, as i want to retain content for all content properties.
//here we intercept the actual data and replace any unicorn mention with "horse"
public override void PackagingProperty(Core.Item item, ItemProviders.ContentProperty propertyData)
{
//get the refence to the property data object the data is part of
var properties = (ContentPropertyData)item;
if (propertyData.Value.ToString() == "unicorn")
propertyData.Value = "Horse";
}
So could you please suggest in which file i have to write this code.
is working on a reply...