Return to doc.sitecore.com

  Handling System Events
Prev Next

Instead of various Sitecore V4 handlers (like ItemEventHandler, MediaHandler, Publishing Handler and so on), Sitecore V5 offers unified event model.   

Sitecore V5 events also address some of the shortcomings that Sitecore V4 handlers had.  

To port your specific handler to Sitecore V5 you need to

Example:  

Say, you had an Item event handler that replaces all ‘*’ symbols in an Item’s name (taken from Sitecore V4 server events article):  

public class CustomItemHandler : IItemEventHandler

{
  
//Replaces the "*" symbols on gaps
   void IItemEventHandler.HandleSaved(IMasterItem itm, NameValueCollection configSettings)
   {
      
string szTitle = itm.GetFieldValue("Title");
      itm.GetLatestVersion().SetFieldValue(
"Title", szTitle.Replace("*"," "));
   }
}

and the handler is registered in web.config in the following way:  

   <eventHandlers>
     ...
      <items>
        …
        <handler mode="on" assembly="CustomItemHandler" type="CustomItemHandler" CustomNodeTitle="New Item: "/>

      </items>

      ...

    </eventHandlers>


Prev Next