The rest of the code is wrapped in a try-catch-finally block in order to handle an eventual error correctly: generate an error message, set the status to Cancel With Error and cancel the event handler.
Before the list item is updated, you have to disable the event receiver from firing by executing the this. In this case it is not really necessary because there is no Item Updating or Item Updated event handler.
I’m not sure if it was my particular mix of SP1, Site Content types, 64bit server, and the use of a Business Data column on the document library that was making it not work, but I simply had to use the display name, or else none of the data I set would stick (my column names had a mix of spaces and no spaces, and interestingly the column names with no spaces worked either way).
I’m Karine Bosch and currently I’m working as Share Point Solution Architect for Recomatics, a company located in Destelbergen near Ghent.It also seemed to create my second problem, where data I did set disappeared.Once I got things working with the Display Name of the field, I then noticed that I had a problem with the data disappearing after I would edit the properties of the document.Each time a document is created or uploaded, the event handler will execute: The event receiver will run for each document library in the site collection on which the features is deployed.If you want this event handler to only run on this particular document library, you could test on the list name in your code.This event receiver will calculate a code for each Word 2007 document that is added or uploaded based on the selected planet and the number of documents already uploaded to the document library. Open Visual Studio 2008 and create a class library project with the name Documents Event Receiver. Add therefore the following code: The code start by encapsulating the whole in a using (SPWeb web = properties.Open Web()) this to dispose from the SPWeb instance and avoid memory leaks when the code finishes running.As in the first walkthrough, the assembly containing the event handlers must be deployed to the Global Assembly Cache.The structure of the feature is exactly the same, except from the file.And proud MEET member If you don’t find the answers to your questions on this blog, you can always post your questions to the Share Point 2010 forum or the Share Point 2013 forum.I had the need to set Business Data and other column values in the Item Adding event handler.