Event Receivers on Content Types

Adding this to the category of things-that-I-didn’t-know-but-would-have-made-a-lot-of-stuff-I-previously-wrote-much-more-elegant-and-awesome.

You should add it to yours, too!

As a quick summary, it’s common knowledge (well, amongst SharePoint developers at least) that you can associate event receivers with a list template type.  However, an interviewer recently brought to light that one can also associate an event receiver directly with a content type.  This is immensely useful for anyone building custom solutions on SharePoint, especially if you make heavy usage of content types in your design.

Here’s an example using the same basic content type:

Oddly enough, I was trying to figure out what the Filter element does when I stumbled upon the stackoverflow posting by accident. As it stands, I still can’t figure out what the element is and what XML is valid for it. Perhaps some CAML query filter?

You may also like...