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:
base.ItemFileMoved(properties); SPListItem movedFile = properties.ListItem; // some changes to my columns movedFile.Update();
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.