SharePoint Event Handler Errors

In case you receive the following error message while working with add or update event handlers in SharePoint 2007:

“The file <name> has been modified by <domain\user name> on <date>” 

event-handler.jpg

And the scenario is that sometimes this error occurs and sometimes it does not while you upload/add a document or update a document library field….
whatever is the event handler you used e.g. ItemUpdated, ItemUpdating, ItemAdded or ItemAdding, you must be updating your changes somewhere as follows:

 Item.Update();

Try replacing this statement by the following:

this.DisableEventFiring();
Item.SystemUpdate(false);
this.EnableEventFiring();

This resolved my problem and the occasional ‘modified by’ such and such ‘user’ at such and such ‘time’ does not appear anymore…………… 🙂

 Hope this helps—–happy coding!!

Advertisements
  1. April 4, 2008 at 3:39 pm

    I just started Share point portal. This gives me idea.
    Thanks, Ali Raza and Arsalan Ayub also my friend 😛

    Arsalan has gone to bahrain. Mashallah.

    Good topic’

    Rana

  1. January 7, 2010 at 6:20 am

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: