I am trying to create a feature that uses the API for associating an ItemAdded event receiver to a Discussion List. I was associating the Event Receiver to the SPList, however, i don't want the event to fire when Replies are created (Message Content Type), only when Threads (i.e. Discussion Content Types) are created.
In my situation, I have a Feature Receiver and essentially the following code:
SPWeb web = properties.Feature.Parent as SPWeb;
if (web.Lists["Team Discussion"].ContentTypes["Discussion"].EventReceivers == null)
throw new Exception("null ...darn");
Will SharePoint allow me to associate event receivers on particular lists content types?
In this case, if the users add additional discussion boards, I don't want to register them with my event reciever, so I don't want to add the association at the web level.
EDIT: I actually need to handle ItemAdded, ItemUpdated, and ItemDeleted, not just ItemAdded. The CUD on the list is not very intensive, however, there are a few hundred instances of the list. I am aware of creating a new Content Type, however, this will require backporting hundreds of lists and migrating each OOB Discussion ListItem to a new Custom Discussion Content Type, not to mention will require testing to see if SPUtility.CreateNewDiscussion() will play nicely with the new custom Discussion CType.