Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I need to copy Existing file to A folder("Archive") while another file is uploaded with same file name to the document library.

Ex I already have a filename "example.txt" in a document library. Now i upload another file with same name "example.txt"."Overwrite existing files" is checked while uploading it. It fires only "ItemUpdating" and "ItemUpdated" events but it doesn't fires "ItemsAdding" event.

Edit and updating property for any file fires "ItemUpdating" and "ItemUpdated" events. It is a normal functionality. But while uploading file with existing filename also fires the "ItemUpdating" and "ItemUpdated" events. Why it is not firing "ItemsAdding" event?

Any Suggestions??

share|improve this question

2 Answers 2

check out this post

The solution could be using the field properties.AfterProperties["vti_contenttag"] in the itemupdating ER for control that scenario.

share|improve this answer

It's because the text "Overwrite exising files" is a bit misleading.

The correct text should be "If any files exist with same name should the file part and promoted properties of these be overwritten?", but someone writing the texts apparently decided that users wouldn't understand this. But this is in fact what goes on SharePoint modifies the exising item only overwriting the file part and promoted properties. All other exising properties from the old entry and ID are preserved.

So it is only an Item Update

share|improve this answer
    
Thanks for your reply. Now I have two situations. 1.Adding a document with Existing document name in library. 2.Editing just properties for the document. In both cases ItemUpdating and ItemUpdated only calling. I need to identify they request comes from case 1 above.(So i can copy the old file to another folder before the new one gets replaced). Any ideas?? –  Raja May 31 '12 at 5:42

Your Answer

 
discard

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.