Wednesday, April 15, 2009

SPEmailEventReceiver not working?

I was working on the SPEmailEventReceiver attach to sharepoint list and faced the same issue that most of the people faced. Once you deploy the code to GAC and attach receiver code works fine. After that if you change the code and deploy the assembly event doesnt get fired.

The only problem here is that somehow sharepoint receiver handler keeps referencing old
assembly version and as a result doesnt fire the event.

Solution is to change a version number every time you deploy the dll to GAC. Remove the receiver and attach once again. This way sharepoint always refers to a new version of the dll
and event is fired all the time.