SharePoint (MOSS) Event Handlers using Content Type Deployed as Features
In my post earlier, I wrote how to create event handlers which get associated with all the lists/document libraries of specific types. You can change the elements.xml file as follows to create and register event handlers against it. Later you can associate the content type with any document library for example, to associate the event handler only to that particular library.
Elements.xml file contents would look like this:
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<ContentType ID="0x010100B6507616196543198ED529CE8720311F" Name="MyContentType" Group="MyGroupForContentType" Description="Event handler enabled content type." Version="0">
<XmlDocuments>
<XmlDocument NamespaceURI="http://schemas.microsoft.com/sharepoint/events">
<spe:Receivers xmlns:spe="http://schemas.microsoft.com/sharepoint/events">
<Receiver>
<Name>ItemDeleting</Name>
<Type>ItemDeleting</Type>
<SequenceNumber>2500</SequenceNumber>
<Assembly>MyProject, Version=1.0.0.0, Culture=neutral,
PublicKeyToken=456g1dh4314356c3</Assembly>
<Class>MyProject.MyEventHandlerClass</Class>
<Data>
</Data>
<Filter>
</Filter>
</Receiver>
</spe:Receivers>
</XmlDocument>
</XmlDocuments>
</ContentType>
</Elements>
Comments
Post a Comment
Feel free to give constructive feedback or let me know if it was helpful.