How to change Modified date programmatically in Episerver

Published on in C# and Episerver

Last updated on

When migrating content from another platform to Episerver, I wanted to set a specific datetime for each content's Modified date (Saved property). Sounds simple, but it was only possible by using Episerver's internal, undocumented API. Here's how it can be done. (Tested on EPiServer.CMS versions 11.14.0 and 11.19.0.)