Event handler in SharePoint has two implementation methods: sps2003 implementation means (you need to enable "backward compatible event handler" in the SharePoint 3.0 Management Center) and sps2007 implementation means, for specific differences, please search for them online. Here we will talk about the precautions for deploying them.
The implementation method of sps2003 is generally to implement the ilisteventsink interface;
The sps2007 inherits the spitemeventreceiver and reloads functions such as itemxxxed (or itemxxxing.
After compiling the DLL file and putting it in GAC (In this experiment, we feel that the DLL compiled by sps2007 must be put in GAC, and sps2003 can be placed in the bin directory of the site ), sps2003 can passGo to the List page-> Settings-> document library settings-> advanced settings-> enter "backward compatible event handlers"OfAssembly nameAndClass Name(Namespace. Class Name) Implement Custom Event processing;
The sps2007 method is troublesome. to deploy it through programming or feature, refer to writing and arranging a list event receivers.
However, I tried to introduce 1. arrangement by programming; 2. if you use feature to deploy the settings, the results all fail. You still need to refer to the Code (Program-based deployment) in SharePoint 2007 tutorial. The Code is as follows ).
Code
Static void main (string [] ARGs)
{
String siteurl = "http: // sitename ";
Spsite site = new spsite (siteurl );
Site. openweb ("/subsite ");
Spweb = site. allwebs [0];
Splist list = web. Lists ["mylistname"]; // mylist is a list name under the site.
List. eventreceivers. Add (speventreceivertype. itemadded, "namespace, version = 1.0.0.0, culture = neutral, publickeytoken = 588feef3b55243a7", "namespace. classname ");
}
The ilisteventsink interface is not exposed if the class "test. demohandler" in "test" appears. An object of the test. demohandler type cannot be forcibly converted to the Microsoft. Sharepoint. ilisteventsink type ".
It means that you have used sps2003 to deploy the event processing DLL of sp2007.
The above is a bit of experience for your reference :)
PS: we have finally solved the problem of event handling, which is tiring ~