SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a document library. In ItemUpdated I move the file to a different location (based on date) and I want to add some metadata in ItemFileMoved to the file's new columns (which I added). The problem is I receive an error related to ItemFileMoved:

<nativehr>0x81020015</nativehr><nativestack></nativestack>The file file/path has been modified by Domain/User on 04 Jan 2013 10:36:02 +0100.

This is my code in ItemFileMoved:

SPListItem movedFile = properties.ListItem;
// some changes to my columns

I'm not sure what I am doing wrong. My questions are: 1) Is the problem in the way I get the item? How can I get an SPListItem for a file if not using properties.ListItem? 2) Is it better to modify files metadata in ItemUpdated before I use file.MoveTo?

Thank you in advance for any help.

share|improve this question
up vote 1 down vote accepted

I have not personally run into this issue but it sounds a lot like an unsafe update error. Assuming properties.ListItem is a reference to the newly moved file and not null or somehow have a reference to the old file location, you can try something like this:

movedFile.Web.AllowUnsafeUpdates = true;
movedFile.Web.AllowUnsafeUpdates = false;

Another theory you can play with - I've also seen some interesting behavior with events that depends on base.Event(properties) and where it is in the code. This was a long time ago so I don't remember specifics on what worked for me or what issue I was having, but you could try moving it to the end instead of the beginning of your method call, or removing it altogether and see what happens.

Hopefully something here can help you out.

share|improve this answer
Thanks, it works. I only get new errors when creating new folders, but I suppose it's a new issue :-) – Maurice Kay Jan 7 '13 at 12:36

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.