November Happy Hour will be moved to Thursday December 5th.

Set a rule for a default unpublish value

Vote:
 

Hi,

 

anyone know if it's possible to configure a default unpublish rule, for example we would like all our news to have a default unpublish date which should occur based on publish date +7 days?

Tried to find this through googling but haven't found a solution, so I thought I'd try here.

 

Thanks

Mikael

#73757
Aug 08, 2013 10:43
Vote:
 

It's possible to set the StopPublish date when creating a new page se snippet below, so It should be possible to do what you want if you set the date on the publish event.

See this blogpost on how to easy jack into the EPiServer events: http://talk.alfnilsson.se/2013/03/17/simplifying-event-handling-in-episerver-7-cms/ 

 

Set default date when creating new page:

public override void SetDefaultValues(ContentType contentType)
{
base.SetDefaultValues(contentType);
StopPublish = "Your new date";
}

#73762
Aug 08, 2013 11:35
Vote:
 

You can do what Per said or you can hook into the publish event and set the stop publish date there as well.  Either one will work.  If you don't want to do it at the model level and want to have more conditions before setting it, I would suggest the publishing event.

#73815
Aug 11, 2013 18:27
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.