In the previous section, we created the companyitemeventaggreger class to use uppercase letters in company names to maintain data integrity. as the last part of the event handler er series, we want to demonstrate how to bind event handler in the event handler er class to the content types of company. this is done by using an inner xmldocument node in content type definition. The following is an example. you can see that each event handler must be bound with the same information separately.
<ContentType ID="0x0100E71A2716C18B4e96A9B0461156806FFA" Name="Company" > <!-- FieldRefs element omitted for clarity --> <!-- event handlers added to content type using XmlDocument element --> <XmlDocuments> <XmlDocument NamespaceURI="http://schemas.microsoft.com/sharepoint/events"> <spe:Receivers xmlns:spe="http://schemas.microsoft.com/sharepoint/events"> <spe:Receiver> <spe:Name>ItemAddedReceiver</spe:Name> <spe:Type>ItemAdded</spe:Type> <spe:Assembly>LitwareTypes, [full 4-part assembly name] </spe:Assembly> <spe:Class>LitwareTypes.CompanyItemEventReceiver</spe:Class> </spe:Receiver> <spe:Receiver> <spe:Name>ItemUpdatedReceiver</spe:Name> <spe:Type>ItemUpdated</spe:Type> <spe:Assembly>LitwareTypes, [full 4-part assembly name] </spe:Assembly> <spe:Class>LitwareTypes.CompanyItemEventReceiver</spe:Class> </spe:Receiver> </spe:Receivers> </XmlDocument> </XmlDocuments></ContentType>
Translated from:
Inside Microsoft Windows SharePoint Services 3.0