I need to rename an uploaded document by adding some additional information to its file name, currently I do this with an Event Receiver ItemAdded
wiring up on Document Library, using code
SPListItem material = properties.ListItem;
material["Name"] = RenameFile(material["Name"].ToString());
material.Update();
//material.UpdateOverwriteVersion(); //same issue
This would works fine until the same file is uploaded again, after renaming the error "the specified name is already in use"
will occur although I have enabled document version control.
Do I need to create a new version programmatically? if so, how am I supposed to do it, can someone shed some lights on this? Any help is deeply appreciated.
This may be of some help
http://social.msdn.microsoft.com/Forums/en-US/sharepointdevelopment/thread/1f003923-dc88-427b-a6b8-34c3616d5b1a/
I think you need to check the document out and then back in