Share via


Binding to a Document Library Event Handler (Windows SharePoint Services 2.0)

Microsoft Windows SharePoint Services includes changes that allow you to bind an event handler to a document library. With this feature, you can use document library events to start other processes, such as workflow processes. You can develop managed code that takes advantage of document library events and create an application based on Windows SharePoint Services to perform whatever actions you need. When you combine document libraries, your own event-handling managed code, and possibly XML forms, you can create complex workflow processes that are easy for users to work with.

For example, in the healthcare industry, when a new patient is admitted to a hospital, there is a lot of paperwork that needs to be generated, and it needs to be done in a specific order. You can write an application that interacts with XML forms in a document library to do such things as:

  • Track when a new admissions form is added to the document library.

  • Extract the insurance information and forward it to the billing application.

  • Notify the staff in the appropriate section of the hospital to pull the patient's chart.

Tracking Events in Document Libraries

The following events can be tracked for document libraries.

Event Description

Insert

A new document is added to the document library.

Update

An existing document is edited.

Delete

An existing document is deleted.

Move

A document is moved or renamed.

Copy

A document or folder is copied.

Check In

A document is checked in.

Check Out

A document is checked out.

Cancel Check-Out

Changes made to a checked out document are undone.

For more information about writing managed code to interact with document library events, see the Microsoft Windows SharePoint Services Software Development Kit.

Enabling Document Library Events

If you want to allow developers in your organization to use the document library events to write code, you must enable this feature at the virtual server level.

Enable document library events for a virtual server

  1. Click Start, point to All Programs, point to Administrative Tools, and then click SharePoint Central Administration.

  2. Under Virtual Server Configuration, click Configure virtual server settings.

  3. On the Virtual Server List page, click the name of the virtual server you want to configure.

  4. On the Virtual Server Settings page, under Virtual Server Management, click Virtual server general settings.

  5. On the Virtual Server General Settings page, in the Event Handlers section, next to Event handlers are, select On.

  6. Click OK.

After the feature is enabled, you can write code to handle the events, and then specify the code to use for a particular document library in the document library settings.

Enable document library events for a specific document library

  1. On the appropriate Web site, navigate to the document library you want to monitor.

  2. Under Actions, click Modify columns and settings.

  3. Under General Settings, click Change advanced settings.

  4. In the Event Handler section, in the Assembly name box, type the strong name of the assembly containing the event handler class.

  5. In the Class Name box, type the full class name for the event handler.

    Note

    The Class Name value is case sensitive.

  6. In the Properties box, list any appropriate properties for the event handler.

  7. Click OK.

    Note

    Be aware that event settings are preserved when a document library is saved as a list template. For more information about templates, see "Working with Templates" in the Windows SharePoint Services Administrator's Guide.