Set Expiration Date for Module Builder item
I'm working on a job posting module and would like to allow my users to specify when their job posting should expire. How can I programatically set a date to unpublish/expire my content whenever the job posting is being persisted?
Any ideas?
Have the same issue!
Is there an equivalent to manager.Lifesycle.PublishOnASpesificDate ?
I need to set expiration to dynamic module items programmatically.
Hello,
Each dynamic content item inherits IScheduleable interface thus they have ExpirationDate and PublicationDate properties. I have created a sample demo code for your convenience:
var providerName = String.Empty;DynamicModuleManager dynamicModuleManager = DynamicModuleManager.GetManager(providerName);Type testItemType = TypeResolutionService.ResolveType("Telerik.Sitefinity.DynamicTypes.Model.Testmodule.TestItem");DynamicContent testItemItem = dynamicModuleManager.CreateDataItem(testItemType);testItemItem.ExpirationDate = DateTime.Now.AddDays(30);testItemItem.PublicationDate = DateTime.Now;