Try our conversational search powered by Generative AI!

Copy a page property value to another


Is it possible to copy a page propety value to another? I'd like to copy the StopPublish to a new DateTime called ExpDate. I've looked at the tables in the database but is it poosible to just insert new lines into this one without anything else suffering or breaking?

May 16, 2013 15:56

I tried inserting a line into tblProperty but that was not enough. The value is not showing up in edit mode.

May 16, 2013 16:22

You could get it to work by inserting values directly to database tables but I would not recommend that (e.g. notice that fkPropertyDefinitionId is not same for different properties).

I would do it through the API by write a small job (e.g. a scheduled job) that recursively traveres the content tree and sets the property value and "resaves" the content, you can use SaveAction.ForceCurrentVersion if you do not want new versions created.

May 17, 2013 13:13

Yeah, I guess that's the way to go. I'll just do like you say and write a code and loop them through. Thanks for the input!

May 17, 2013 15:27

I would probably solve it by reacting to the publish event and copy if it is not equal already. Careful so that you don't enter an infinite loop though :)

May 17, 2013 17:55

My assumption was that the issue was about changing existing pages, if that is not the case then Daniels approach of hooking up to event is better. 

If you always want the property values (StopPublish and ExpDate) to be the same then the suggestion is to mark your ExpDate property with Ignore attribute (then it will not get a backing field in database) and simply implement the getter as returning the value from StopPublish.

May 17, 2013 20:51

Sorry for the late reply. I want to also remove the current StopPublish values so a loop seems to be the best way.

May 20, 2013 15:45
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* 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.