Try our conversational search powered by Generative AI!

[Question]StopPublish is readonly?

Vote:
 

I'm fairly new to EpiServer so maybe this question has been answered before. I couldnt find any easily but here goes;

When my page is saved, I check certain fields and when a field is set, the page should be archived. I want to set StopPublishto a date in the past but when I excute the code in the page I get a validator error; 

  • The property PageStopPublish is read-only.

I don't get this, why was the property settable in C# in the first place? I don't have any custom validators regarding StopPublish

#200714
Jan 23, 2019 11:05
Vote:
 

You would need to create a writeable clone for your content before you can change a property and save. Something like

var writeableClone = pageData.CreateWritableClone<PageData>();

//edit writeableClone 

#200715
Jan 23, 2019 11:37
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.