IDataEvent

The IDataEvent represents a contract for event notification containing minimal information about modified items. As you want to have a global event for all content, you can subscribe to the IDataEvent - it will be thrown on the Create, Update, and Delete actions for all content. Inside the event handler you can get information about the:

  • Event Action
    • New (corresponds to Create action)
    • Updated
    • Deleted
  • ItemType
  • ItemId
  • ProviderName

This data is sufficient to allow you to load the corresponding manager and retrieve the actual item.

To subscribe to the IDataEvent:

  1. In Visual Studio, in your project, open the Global.asax file.

    NOTE: If you do not have a Global.asax file, create a new Global.asax file and add it to your project. In the context menu of your project, click Add » New Item… » Visual C# » Web » Global Application Class..

  2. Add the following code:

As a result you are subscribed to the IDataEvent and you can access the event's ID, provider name, action, item type. and so forth. You can modify the event's attributes, subscribe an email address to the event, and so on.

Want to learn more?

Sign up for our free beginner training. Boost your credentials through advanced courses and certification.
Register for Sitefinity training and certification.

Was this article helpful?