help.axcms.netAxinom Logo
Save Save Chapter Send Feedback

Extending Publishing Process

How to extend the publishing process with your own code.

If you want to extend the publishing process with your custom actions, you can do it using the Publishing Event Model, offered by Possible usage is: you want to be notified about publishing of the new pages and/or documents and, e.g., notify some users about it, log the actions or create additional data structures.

To create a Plug-In for publishing follow this steps:

1. Create a new Visual Studio-Project, create a class and implement the interface IPublishPlugin. The interface has two Init-methods. These methods are called once on initialization of the plugin. In these methods you get a publishing-object as a parameter, which exposes following events:


And the same set of 4 events for the documents. 

2. Register your event handlers and implement them. Example:
public void Init(PublishingPage publishing)
    publishing.BeforePageUpdate += new PagePublishEventHandler(BeforePagePublishing);

public void BeforePagePublishing(object sender, PagePublishEventArgs e)
    // do something

PagePublishEventArgs and DocumentPublishEventArgs objects provide all the necessary information about the page (document) being published.

3. Compile your project and put the resulting DLL into the bin-folder of the AxCMSPublishService-application (if you use WebService-PublishAgent) or into bin-folder of AxCMSweb-application (if you use InProcess-PublishAgent).

4. The system will automatically find and load your plugin and raise the events, as pages/document are being published.

Note. If your plug-in throws an exception, if is handled the same way as an exception in The user will be notified, that publishing has not succeeded and developer will get the exception published through the regular exception publishing configured.