skip to content »

Spitemeventreceiver itemupdating afterproperties

spitemeventreceiver itemupdating afterproperties-73

This is a less often used approach, which raises two questions – how do you do it, and what happens to child Content Types?Continue reading While working on pre-filling List Item fields on an item, I became a bit puzzled. After Properties collection is a dictionary which can contain the named value for one of the fields of the item.

spitemeventreceiver itemupdating afterproperties-37spitemeventreceiver itemupdating afterproperties-77spitemeventreceiver itemupdating afterproperties-22

They are executed on certain moments(events) on a Share Point lists, libraries etc. Personally, I think this may be a bug; I don’t see why this shouldn’t work at the SPSite level.Anyway, there is still another option – we could register our event against a particular Content Type.Are you able to debug your Event Receiver when you modify an item in the list? It appears no matter what you do to the after properties it doesn't change anything It is nice to update Title in Item Adding and Item Updating events since extra Updates are avoided (without Disable Event Firing), and the "Edit Properties view" will already have the Title filled in Some code example to update title based on filename. For working with Title in Lists, ["Title"] needs to be used.I have loged the value before an after changing and can see the value change. Perhaps this is why the Document ID feature fails to remove the content types that it adds. I’ve got an event handler on a Share Point list that’s fairly long running, and this then raised a question in the office – do these settings control event firing for the currently running event handler, or for the entire list? You can do this through an SPWeb (site) scoped feature, declaratively or programmatically with an SPEvent Receiver Definition.

Unfortunately, you can’t declaratively register event receivers at the SPSite (Site collection) level – which would be fantastic – just turn on the feature and across all your site collection lists/libraries of a give type would get additional event receivers.

There is a difference between the behaviour of Before and After properties when dealing with document libraries versus when dealing with lists.

For documents, Before and After properties are guaranteed for post events, such as Item Updated, but Before properties are not available for post events on list items.

List Item Item Adding No value No value Null Item Added No value No value New value Item Updating Original value Changed value Original value Item Updated Original value Changed value Changed value Item Deleting No value No value Original value Item Deleted No value No value Null Also, if you are going to try to compare Before/After values, watch out for these types: People fields, rich text fields (Note), and Date Time fields.

= After Value) Library Before Properties After Properties properties.

Note: Allegedly, this does change if the event receiver is synchronous – the before properties are available. Obviously, for Share Point 2007 systems that doesn’t apply – as ‘*ed’ event receivers are always asynchronous. Are people worried about events not being handled ‘cos firing is disabled, or is this just a convenient way of tracking whether events are enabled or not?