I have an event receiver which works fine (triggering only once) when I drag and drop a file to a document library. It also works fine using the upload button, it will trigger twice as there are two step (upload then metadata update). Moreover, when using windows with explorer view, it will trigger thrice(one add and two update).

I am trying to rename my file and did the 2 options (renaming via updating the "Name" or via SPFile.MoveTo()) both of which is working fine in drag and drop and upload button. But when I am using open with explorer, it triggers the event receiver twice and failed to do a "rename". I run on debug mode to try and see if I execute only one event receiver will be correct, but it appeared not. What happened is that it created a new file with no content while still retaining the original file. It did complete the first event receiver execution.

Quite confusing as it worked well via the SP UI.

  • Would you mind posting your code? I am trying to do something similar and would very much appreciate a good example.
    – user37129
    Commented Dec 18, 2014 at 22:06

2 Answers 2


You can try following code to avoid this:

if (properties.Versionless)

Explorer view

The first event trigger Versionless will be false and in the second one will be true.

Normal Upload

The first event trigger Versionless will be true.

This helps the event handler code to behave the same way for both scenarios.

Hope this helps.

  • Hi, I already tried this and it only works for ItemUpdated.
    – Joe
    Commented Sep 8, 2014 at 12:51

The root problem is that the file has not yet been fully uploaded when the ItemAdded was triggered. The problem is only existential with explorer view. The event should only be triggered right after the file has been fully uploaded which is the case if I upload via the UI.

As a workaround. I have placed a mechanism involving Thread.Sleep to ensure that the file is uploaded first before continuing the execution of my event receiver code. I hope this helps someone facing the same problem.

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.