I have a scenario wherein I have a folder structure where I need to move a file from root folder to that folder structure inside same document library. The catch here is I need to do this by using an email attachment which is sent to this document library. In short I want to move a file from root folder(where the email is being sent to document library) to a folder structure present in the same document library. The approach that I was trying to use is event receivers. I did not have an environment but I have an idea that a file is being added to SharePoint doesn't matter if it is sent by email.

Now could you please correct me if I am wrong in saying event receiver (item added event) will trigger if I try to add an item through an email.

If I am wrong why and what is different than uploading a document manually.

Finally if anyone of you can suggest an alternate solution to this problem.


Yes, this is expected, the Item Added (and Item Adding) event receivers are not triggered by incoming emails.

There are specific event receivers for handling email events which should give you the functionality you require: https://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spemaileventreceiver(v=office.15).aspx

edit: I think the reason for this, in part at least, is that email events are run through the timer service (owstimer.exe) rather than the standard SharePoint processes (w3wp.exe). And to debug these even receivers you should connect to owstimer.exe

  • this dont seem to work. I tried to attach owstimer.exe for debugging but it just sits put. Dont know if it runs in this process. – Sree Kuttan Oct 12 '15 at 14:01
  • One thing I remembered after posting is that you need to restart the SP Timer service, which stops and restarts the owstimer.exe process, after you deploy your updated event receiver. Have you tried this? – Steven Mulkerrins Oct 12 '15 at 14:07
  • Another suggestion would be to try using Event Handler Explorer (sharepoint-develop.com/ehe/Pages/default.aspx) to ensure your event handler is registered correctly. – Steven Mulkerrins Oct 12 '15 at 14:07
  • Yeah the owstimer restart did the trick... Thanks for your help. BTW this was in local now i am going to deploy in test. Hope it works. – Sree Kuttan Oct 12 '15 at 15:02
  • Good luck :) Actually, you just reminded me of one of the nice things about developing email event receivers. When deploying, you only have to restart owstimer, which you can do pretty easily without impacting end users. – Steven Mulkerrins Oct 13 '15 at 9:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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