Also not sure why the Event Receivers were missing in the first place.
I’ve written a one-off script (Console App) that loops all lists with a Managed Metadata field on all sites in the site collection and ensures the Taxonomy event receivers. I’m guessing the Optional/Required setting of the Managed Metadata field is involved somehow, but I didn’t really confirm that through testing.The library was configured with multiple Content Types, but the issue occurred only on some of them.It appeared that for those Content Types, the Managed Metadata field was Optional, not Required.There’s a difference in behavior for Lists and Libraries; the former allows you to also read/write from the Context. It can be used to declare additional information and then the Event Receiver code behind can use this information. Afterwards the user is presented with the option to change the Content Type which will trigger Item Updating and Item Updated for the destination Content Type I’m starting to see the light although I do think that the Recycle Bin thing is a design flaw. Currently I’m thinking an additional check on Content Type in your code might be the safest way to ensure your code doesn’t run accidentally for a different Content Type ? Today I got into some code reviewing of an Item Event Receiver using Enterprise Library for data access.Session, while the latter doesn’t allow this (Session is null). Better than hardcoding although I haven’t had the need for it (yet ? According to the official docs it is reserved: Event Receivers Result Set Thank you Thomas for helping me on this one ! The problem occurred when registering the Event Receiver for a Share Point List using the object model (SPList. Apparently when the Event Receiver is registered it instantiates the My Data Access class which in turn calls the Ent Lib method in its constructor. Here’s a scenario that fails every time and everywhere: [SPUser Code Solution Execution Failed Exception: Unhandled exception was thrown by the sandboxed code wrapper's Execute method in the partial trust app domain: The sandboxed code execution request was refused because the Sandboxed Code Host Service was too busy to handle the request.] So what’s going on here ?
In light of this you might conclude that there’s no possible communication between two sandbox code requests (the Web Part and the Event Receiver).
A common way to use these collections is to HTML-encode the values supplied by the user before they are stored in the data source. For more information about handling events, see NIB: Consuming Events.
When we need to validate something or put restriction before adding or modifying data, at that time we need to use Item Adding or Item Updating Event Handler, here I’ll demonstrate how to access fields of List into event handlers.
I’ve (ab)used this once on a project where I’d call a custom Layout Page called with Query String parameters to force a SPList Item. In the Event Receiver the code would interact with the values of those parameters. Also here’s a good reference: Share Point 2007 Deployment: Event Registration Features I'm currently doing quite some research on Event Receivers (ERs) on Content Types (CTs) and activating those CTs on a document library in Share Point 2007 (WSS 3.0 to be exact, but same applies for MOSS 2007 and MSS(X) 2008).
The Item Updating event is raised when an Update button within a Details View control is clicked, but before the update operation.
A look at the Item Xml confirmed this: I didn’t want to script an update to all files (because that would trigger Event Receivers) so I avoided querying those properties directly and instead created an extension method to get those values through the SPList Item: There were a lot of Event Receivers in the custom solution so I didn’t take this path, mainly because I noticed in Share Point 2010 the SPList Item.