This documentation is archived and is not being maintained.

Registering Event Handlers as Content Types

Windows SharePoint Services 3

This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This page may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.

Content types are your reusable building blocks within the Windows SharePoint Services data store. Because of this, the event handlers you register at this level are specific to a certain behavior you want to support. Take, for example, a content type like Product Specification, which you might add to a Shared Documents document library. You could create event handlers and register them at the level of the content type, Product Specification, which takes care of very specific processing regarding a specification. When users use this content type, they immediately also get this behavior attached to their list or library.

If your need is to register an event handler for a specific list or library, or for a specific set of lists or libraries, you do it at the level of Features. With regard to lists and libraries, Features are a new, atomic Windows SharePoint Services concept representing specific Collaboration Markup Language (CAML) sections that were previously all consolidated within one file (SCHEMA.XML or ONET.XML). In Windows SharePoint Services 3.0, these CAML sections are now isolated, which means that you can reuse them in different places. You now create the structure and the field definition of a list through a Feature.

With regard to our event handler registration, you can use the concept of the Feature to register your assembly for one specific list or library (by specifying the GUID of the list or library) or for a certain type of list or library (such as all the document libraries or all the form libraries). You define a Feature by creating the same two types of XML files (Feature.xml and Element.xml), as described in Registering an Event Handler.

Show: