Don't miss out Virtual Happy Hour this Friday (April 26).

Try our conversational search powered by Generative AI!

Update Changed date?

Vote:
 

Can i update the changed date by code?

I´m trying like this.

var writablePage = page.CreateWritableClone();

writablePage.Changed = theNewDate;

DataFactory.Instance.Save(writablePage, SaveAction.Publish);



#123595
Jul 09, 2015 14:13
Vote:
 

Hi,

You could try to use UIDefaultValueForSetChangedOnPublish configuration option. The similar question was on the forum before:

http://world.episerver.com/Modules/Forum/Pages/Thread.aspx?id=88654

http://world.episerver.com/Modules/Forum/Pages/Thread.aspx?id=113298

#123597
Jul 09, 2015 14:24
Vote:
 

Hi, but i need a specific date, not the date i publish the page. If i use SetChangedOnPublish then i get the date when the page is publish

#123599
Jul 09, 2015 14:51
Vote:
 

I found that in ContentSaveDB the change date and a publish date could be overriden by using UseIChangeTrackingSaved.

But instead of setting Changed property try to set Saved property.  The code is below.

var writablePage = page.CreateWritableClone();
 
writablePage.Saved = theNewDate;
 

EPiServer.BaseLibrary.Context.Current[ContentSaveDB.UseIChangeTrackingSavedKey] = new object();

DataFactory.Instance.Save(writablePage, SaveAction.Publish);
#123602
Jul 09, 2015 15:44
* 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.