Wss3 SDK Study Notes 4: Event Processing

Source: Internet
Author: User
This article Article This section describes how to create an event handle application.

I,CodeCreation

1. Create a class library (classlibrary) in)
2. Add a reference to Microsoft. Sharepoint. dll. The new class inherits Microsoft. Sharepoint. spitemeventreceiver. Using System;
Using System. Collections. Generic;
Using System. text;
Using Microsoft. SharePoint;

Namespace Simpleeventhandler

{
Public ClassSimpleeventhandler: spitemeventreceiver{
}
}

3. You can rewrite the following methods to process your events.

Itemattachmentdeleting

Itemcheckedin

Itemcheckedout

Itemcheckingin

Itemcheckingout

Itemdeleted

Itemdeleting

Itemfileconverted

Itemfilemoved

Itemfilemoving

Itemuncheckedout

Itemuncheckingout

Itemupdated

Itemupdating

In this example, we will rewriteItemupdating andItemadded The code for these two events is as follows:

 

  Public   Override   Void Itemupdating (spitemeventproperties properties)
{
Properties. Cancel= True;
Properties. errormessage= "Updating is not supported.";
}

Public   Override   Void Itemadded (spitemeventproperties properties)
{
Properties. afterproperties ["Body"]= "Body text maintained by the system.";
}

II. Application
1. Enable event handle
Go to "Management Center"-"application"ProgramManage-SharePoint Web Application Management-General Web application settings, find backward compatible event handlers, and set to enable ".
2. Edit the project or website created by your vs. Remember to compile it into a strongly-named assembly and deploy it in the bin directory of your WSS website. Of course, it can also be deployed in GAC.
3. Select "Advanced Settings" in the document library settings for event processing on the WSS website, and in the "backward compatible event handler" item"Assembly Name:"Joe. eventhandler. demo, version = 1.0.0.0, culture = neutral, publickeytoken = 0172133e8127fd96, where Joe. eventhandler. demo is the namespace, version is the version number, and publickeytoken can be seen in GAC,"Class Name: "fill in the namespace and Class Name: Joe. eventhandler. Demo. documenthandler, and then click OK.
4. Go to the corresponding document library to test your application.

 

Related Article

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.