Tuesday, 9 December 2008

How to bind SharePoint event receivers to a custom list definition

In most cases you want to create your own list definition with your own event receiver that sould only react on events of your custom list.
SharePoint ships with alot of list definitions with unique list type numbers:
100: Generic list101: Document library104: Announcements listand many more.
You can create event receivers that react on events of these list types.
To create a custom list definition you should use the visual studio template "List Definition" shipped with the VSeWSS 1.1. If you create a custom list with base type "document library" its id will also be 101. It's just a copy of the template you selected.

First line of schema.xml after creating the custom list definition project: