Event handlers from code – redux!

Ok, well I think I’ve worked out why the GUId isn’t getting defined.

The code I’ve written creates an EventHandler on the base content type. When this content type gets assigned to a library, the content type is instanced to the library and as a result I think the GUID i assign is removed.

I think were I to assign an event handler directly to a list, then this wouldn’t be the case and I could give a GUID in the creation method.

I’ve not tested this yet, but it seems to make sense.

Paul.

1 comment

  1. Redux twice.. I got back to working on this and found out what happens to the Event Handlers.

    When you update the master content type, the Event handlers get applied to the SPList.EventReceivers collection of the list containing the Content type. This collection happily shows a GUID, which isn’t the same as the one that we specified on the Master cType, which is as we’d expect as SharePoint has instanced the event handler to the list.

    Paul.

Leave a Reply

Your email address will not be published.

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.