We are working with EpiServer 8, and have a scenario where we use web page monitoring solution to detect unauthorized content changes. The monitor uses a REST API, where we can inform the monitor of a "maintenance period" so that it treats changes made during the maintenance period as authorized.
To solve this problem, our thought is to write code that gets triggered when the EpiServer CMS changes are publshed, or scheduled to be published. When a publish starts, we need to notify the monitor that a new maintenance period has started, and when the publish ends, we need to let the monitor know that the maintenance has ended.
How can I go about doing this? Some preliminary research led me to a 5-year old thread. But I was unable to locate any current approaches for this. Thanks for your help.
You can easily add custom logic to all content events like published or saved etc.
public class EventsInitialization : IInitializableModule
public void Initialize(InitializationEngine context)
var events = ServiceLocator.Current.GetInstance<IContentEvents>();
events.PublishedContent += EventsPublishedContent;
public void Preload(string parameters)
public void Uninitialize(InitializationEngine context)
private void EventsPublishedContent(object sender, ContentEventArgs e)
//Create audit, log stuff...call REST service...
There are quite a few events that you can react to. Published, Moved and Deleted are the most useful...
Thanks for your help Daniel. With your guidance, this was easy to find for the immediate publish event option. For the immediate publish, I'm intercepting the events.PublishingContent event.
What about scheduled publishing? When a scheduled publishing event is saved, I'll need to save a notification to our web page monitoring solution as well. What event in EpiServer can I react to which will have the scheduled publish time? Thanks.
Should be the same. Haven't tested it but it should be the same or I would regard it as a bug.