[List event receivers] Two deployment methods for customizing the "event processing" Function

Source: Internet
Author: User

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 ~

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.