The content of this article is mainly referred to from how to: create an event handler feature
The method in the previous article can only add event responses to a specific list. How can this problem be solved for multiple tables? A solution is to apply a template to a table or table, as long as it is a list generated by the template.
First, we will introduce the ID numbers of various templates:
• 100 generic list
• 101 Document Library
• 102 Survey
• 103 links list
• 104 announcements list
• 105 contacts list
• 106 events list
• 107 tasks list
• 108 discussion board
• 109 picture library
• 110 data sources
• 111 site template Gallery
• 112 user information list
• 113 Web Part Gallery
• 114 list template Gallery
• 115 XML form library
• 116 master pages Gallery
• 117 no-code workflows
• 118 custom workflow process
• 119 wiki page Library
• 120 custom grid for a list
• 130 Data Connection Library
• 140 workflow history
• 150 Gantt tasks list
• 200 meeting series list
• 201 meeting agenda List
• 202 meeting attendees list
• 204 meeting decisions list
• 207 meeting objectives list
• 210 meeting text box
• 211 meeting things to bring list
• 212 Meeting Workspace pages list
• 301 blog posts list
• 302 blog comments list
• 303 blog categories list
• 1100 issue tracking
• 1200 administrator tasks list
Next, we will explain how to register the event processing DLL for these templates and use it as a WSS feature.
1. In Local_drive :/Program files/common files/Microsoft shared/Web Server Extensions/12/template/Features
Create a directory litwarehandlers.
2. generate two files in the directory: feature. xml and elements. xml. The content of the two files is as follows:
Feature. xml Feature. xml
<? XML version = "1.0" encoding = "UTF-8" ?>
< Feature Scope = "Web"
Title = "Litware event handler"
ID = "AF226CD5-8F7A-4d3d-AD9D-5F0254B427C8"
Xmlns = "Http://schemas.microsoft.com/sharepoint" >
< Elementmanifests >
< Elementmanifest Location = "Elements. xml" />
</ Elementmanifests >
</ Feature >
Elements. xml Elements. xml
<? XML version = "1.0" encoding = "UTF-8" ?>
< Elements Xmlns = "Http://schemas.microsoft.com/sharepoint" >
< Receivers Listtemplateid = "100" >
< Cycler >
< Name > Litwareeventhandler-add </ Name >
< Type > Itemadded </ Type >
< Sequencenumber > 10000 </ Sequencenumber >
< Assembly > Litwarehandlers, version = 1.0.0.0, culture = neutral, publickeytoken = 538e86bea3aaf975 </ Assembly >
< Class > Litwarehandlers. orderhandler </ Class >
< Data > </ Data >
< Filter > </ Filter >
</ Cycler >
< Cycler >
< Name > Litwareeventhandler-Update </ Name >
< Type > Itemupdated </ Type >
< Sequencenumber > 10000 </ Sequencenumber >
< Assembly > Litwarehandlers, version = 1.0.0.0, culture = neutral, publickeytoken = 538e86bea3aaf975 </ Assembly >
< Class > Litwarehandlers. orderhandler </ Class >
< Data > </ Data >
< Filter > </ Filter >
</ Cycler >
</ Receivers >
</ Elements >
For more information about eventhandler registration, see the following msdn web page.
Event registrations
3. InLocal_drive:/Program files/common files/Microsoft shared/Web Server Extensions/12/template/features directory: Stsadm-O installfeature-filename litwarehandlers \ feature. xml
Stsadm-O activatefeature-filename litwarehandlers \ feature. XML-URL http: /localhost: 40000/customize
Iisreset
Note: Change the website to your desired one.
4. Return to the orders list and insert a new record or update an existing record to see if the orderid will change.
In addition, if you want to delete the registered eventhandler in the previous article, you can comment out the original registration statement in the program. CS file in the handlerregistrationapp project and add the deletion method. Program Refer to the following:Delete
// Orders. eventreceivers. (speventreceivertype. itemadded, asmname, classname );
// Orders. eventreceivers. Add (speventreceivertype. itemupdated, asmname, classname );
Int CNT = orders. eventreceivers. count;
For (INT I = 0; I < CNT ; I ++)
orders. eventreceivers [0]. Delete ();