SPException:The file abc.doc has been modified by on at Microsoft.SharePoint.Library.SPRequestInternalClass.AddOrUpdateItem(String bstrUrl, String bstrListName, Boolean bAdd, Boolean bSystemUpdate, Boolean bPreserveItemVersion, Boolean bUpdateNoVersion, Int32& plID, String& pbstrGuid, Guid pbstrNewDocId, Boolean bHasNewDocId, String bstrVersion, Object& pvarAttachmentNames, Object& pvarAttachmentContents, Object& pvarProperties, Boolean bCheckOut, Boolean bCheckin, Boolean bMigration, Boolean bPublish)


This error occurs when you upload a file to a document library through the SharePoint UI and when the document library has an event receiver which updates the list item on ItemAdded(). The error doesn’t happen all the time (for instance, it happened only on our Prod) which lead us to conclude that it is due to some race conditions, especially knowing that event receivers are run in separate thread.

The error message is “The file … has been modified by … on ….” and the callstack leads to a COMException in the Microsoft.SharePoint.Library assembly, which is the managed wrapper of OWSSVR.dll. The full stacktrace looks something like this:

[COMException (0x81020037): The file abc.doc has been modified by on ]
at Microsoft.SharePoint.Library.SPRequestInternalClass.AddOrUpdateItem(String bstrUrl, String bstrListName, Boolean bAdd, Boolean bSystemUpdate, Boolean bPreserveItemVersion, Boolean bUpdateNoVersion, Int32& plID, String& pbstrGuid, Guid pbstrNewDocId, Boolean bHasNewDocId, String bstrVersion, Object& pvarAttachmentNames, Object& pvarAttachmentContents, Object& pvarProperties, Boolean bCheckOut, Boolean bCheckin, Boolean bMigration, Boolean bPublish) +0
at Microsoft.SharePoint.Library.SPRequest.AddOrUpdateItem(String bstrUrl, String bstrListName, Boolean bAdd, Boolean bSystemUpdate, Boolean bPreserveItemVersion, Boolean bUpdateNoVersion, Int32& plID, String& pbstrGuid, Guid pbstrNewDocId, Boolean bHasNewDocId, String bstrVersion, Object& pvarAttachmentNames, Object& pvarAttachmentContents, Object& pvarProperties, Boolean bCheckOut, Boolean bCheckin, Boolean bMigration, Boolean bPublish) +411
[SPException: The file abc.doc has been modified by on ]
at Microsoft.SharePoint.Library.SPRequest.AddOrUpdateItem(String bstrUrl, String bstrListName, Boolean bAdd, Boolean bSystemUpdate, Boolean bPreserveItemVersion, Boolean   bUpdateNoVersion, Int32& plID, String& pbstrGuid, Guid pbstrNewDocId, Boolean bHasNewDocId, String bstrVersion, Object& pvarAttachmentNames, Object& pvarAttachmentContents, Object& pvarProperties, Boolean bCheckOut, Boolean bCheckin, Boolean bMigration, Boolean bPublish) +556
at Microsoft.SharePoint.SPListItem.AddOrUpdateItem(Boolean bAdd, Boolean bSystem, Boolean bPreserveItemVersion, Boolean bNoVersion, Boolean bMigration, Boolean bPublish, Boolean bCheckOut, Boolean bCheckin, Guid newGuidOnAdd, Int32& ulID, Object& objAttachmentNames, Object& objAttachmentContents, Boolean suppressAfterEvents) +3030
at Microsoft.SharePoint.SPListItem.UpdateInternal(Boolean bSystem, Boolean bPreserveItemVersion, Guid newGuidOnAdd, Boolean bMigration, Boolean bPublish, Boolean bNoVersion, Boolean bCheckOut, Boolean bCheckin, Boolean suppressAfterEvents) +632
at Microsoft.SharePoint.SPListItem.UpdateOverwriteVersion() +190
at Microsoft.SharePoint.WebControls.SaveButton.SaveItem(SPContext itemContext, Boolean uploadMode, String checkInComment) +256
at Microsoft.SharePoint.WebControls.SaveButton.SaveItem() +111
at Microsoft.SharePoint.WebControls.SaveButton.OnBubbleEvent(Object source, EventArgs e) +476
at System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +50
at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +39
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3215

Fix:

one way to fix the problem is changing your event receiver to update the list item using item.SystemUpdate(false) instead of item.Update(). Some people recommend to disable the event firing when calling the Systemupdate:
this.DisableEventFiring();
try
{
      item.SystemUpdate(false);
}
finally
{
      this.EnableEventFiring();
}

Comments

Anonymous said…
Hi there, just wanted to mention, I liked this article.
It was funny. Keep on posting!
My web site :: how to start a business with no money
Anonymous said…
Definitely consider that which you said. Your favorite justification seemed to be
at the net the easiest factor to keep in mind of.
I say to you, I certainly get irked while other people consider issues that they plainly don't know about. You managed to hit the nail upon the top and also outlined out the entire thing without having side-effects , people could take a signal. Will likely be back to get more. Thank you
my site :: Business Plan Product
Anonymous said…
Sweet blog! I found it while browsing on Yahoo News.
Do you have any suggestions on how to get listed in Yahoo News?
I've been trying for a while but I never seem to get there! Cheers
Also see my page > The Tao of Badass
Anonymous said…
Greetings from Colorado! I'm bored at work so I decided to check out your site on my iphone during lunch break. I enjoy the info you provide here and can't wait to take a look when I get home.
I'm shocked at how fast your blog loaded on my phone .. I'm not even
using WIFI, just 3G .. Anyhow, amazing blog!

Here is my web site ... online shopping in india
Anonymous said…
I do not know whether it's just me or if everyone else experiencing issues with your site. It appears as though some of the written text within your posts are running off the screen. Can someone else please provide feedback and let me know if this is happening to them too? This may be a issue with my browser because I've had this happen before.
Thanks

Also visit my web-site :: facebook quotes
my web site > life quotes
Anonymous said…
Very nice post. I just stumbled upon your weblog and wanted to say that I've really enjoyed browsing your blog posts. In any case I'll be subscribing to your rss feed and I hope you write again soon!


Feel free to surf to my web-site facebook quotes
Also see my web page :: facebook quotes
Anonymous said…
Magnificent goods from you, man. I've take note your stuff prior to and you are just extremely wonderful. I really like what you have obtained here, certainly like what you are saying and the best way through which you assert it. You're making it entertaining
and you still care for to stay it sensible. I can not wait to learn much more from you.
That is actually a wonderful website.

Also visit my blog Odd News
Anonymous said…
Hello my loved one! I wish to say that this post is awesome, nice written and come with almost all vital infos.
I'd like to see more posts like this .

My site: barbells
Anonymous said…
Hi colleagues, good paragraph and good arguments commented here, I am genuinely enjoying by
these.

my web page: Find Energy Solutions
Anonymous said…
Hello, its nice piece of writing concerning media print, we all be aware of media is
a wonderful source of data.

Also visit my web page ... topsportsmodel
Anonymous said…
Excellent post. I was checking continuously this blog and I am impressed!
Very helpful information particularly the last part :) I care for such information much.
I was looking for this particular information for a long time.
Thank you and good luck.

Feel free to surf to my website ... silk scarf
Anonymous said…
Simply desire to say your article is as astonishing.
The clarity in your post is simply nice and i could assume you are an expert on
this subject. Well with your permission allow me to grab
your feed to keep up to date with forthcoming post. Thanks a million and please
keep up the gratifying work.

My website ... Free Porn
Anonymous said…
Hello Dear, are you really visiting this web page regularly, if
so after that you will without doubt take pleasant know-how.



Look at my site - cfnm hardcore
Anonymous said…
I do not even know how I ended up here, but I thought this post was
good. I do not know who you are but definitely you are going to a
famous blogger if you aren't already ;) Cheers!

Also visit my page - voyeur videos
Anonymous said…
If you would like to improve your familiarity only keep visiting this web
site and be updated with the latest information posted here.


Also visit my weblog hotgirlsexcam.com
Anonymous said…
Hi, I do believe this is an excellent web site. I stumbledupon it ;) I will come
back once again since I book-marked it. Money and freedom is the greatest way to change, may you be rich and continue to guide other people.


Take a look at my homepage - xxx fucking
Anonymous said…
This website truly has all the information I wanted about this subject and didn't know who to ask.

Also visit my page ... real party porn
Anonymous said…
Informative article, totally what I wanted to find.


my web blog www.teenpornsexpussy.com
Anonymous said…
An outstanding share! I've just forwarded this onto a friend who had been conducting a little research on this. And he actually ordered me dinner due to the fact that I stumbled upon it for him... lol. So allow me to reword this.... Thanks for the meal!! But yeah, thanx for spending some time to talk about this matter here on your web page.

Also visit my page www.babesflick.com

Popular posts from this blog

Linksys Wireless Connection Failure

The security validation for this page is invalid. Click Back in your Web

Access Denied Host Header Sharepoint 2010 Windows Server 2008 R2