2

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??

2 Answers 2

1

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

1
  • 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
    Commented May 31, 2012 at 5:42
1

check out this post

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

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.