[Sharepoint 2010 – Error Fixing] The file has been modified by … unknown

I got the following error message in visual studio during programing :

“The file has been modified by … unknown”

It was because i called two times (by error) the item.update(); method.

This could happen as well when you code an event receiver (sometime happening when you do something on a list, web, site….) and you use item.update(), in order to fix that :

  •  call and disable event firing before your code with : base.EventFiringEnabled = false;
  • update your item by calling item.systemUpdate(false); 
  • enable event firing with : base.EventFiringEnabled = true;
Advertisements

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