0

I have a simple requirement, yet it seems very complex to implement. When users upload a file to the document library, I want to check if it exists. If it exists I need to rename the file by appending the date (and time) to the end of the file - so that it is unique.

The obvious answer is to use event receivers. When you overwrite a document, It is the update events that fire not the adding events.

My problem is that I cannot tell whether the file is being overwritten or if there it is a property update. Am I missing something obvious?

2 Answers 2

1

You could use versioning on the library. That way, when a file of the same name is uploaded, it will be saved as a new version and the previous version(s) can still be accessed. No code, no event receivers, just out of the box.

1
  • Thanks for your comment. But it my case I want the files to be completely separate. Versioning is not correct in this case. Commented Jul 25, 2013 at 11:16
0

The file will be overwritten in the same item. In the other hand I just wondering why you should overwrite the file by a Event Receiver instead to enable the Versioning of the file.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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