Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more
AI OnAI Off
Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more
Thanks for the reply Erik, I tried using Stop publish date but must be doing something wrong. I tried not using the Instance in the PageDataCollection but it does not work either. I get this error message from the server "The property PageStopPublish is read-only."
public static PageReference parent = new PageReference(10);
public PageDataCollection pageCollection = DataFactory.Instance.GetChildren(parent);
public void unpublishOldPages()
{
foreach (PageData p in pageCollection)
{
if (//Some code)
{
p.StopPublish = DateTime.Now;
}
}
}
You need to create a writable clone of the pagedata object, and then of course save it.
in the foreach
PageData writablePage = p.CreateWrtableClone();
writablePage.StopPublish = DateTime.Now;
Datafactory.Instance.Save(writablePage, yourparams...);
Hi guys:
First time using the forum, hope I can get some help here.
I am currently working on a project where I need to unpublish pages programmatically. If the information does not exist anymore in the source, then I need to unpublish those pages in my EPiServer installation. I found how to publish pages programmatically but cannot find the unpublish option. Any help or tips will be appreciated.
Thanks