Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

EventReceiver not working

12 views
Skip to first unread message

Nik

unread,
Nov 17, 2009, 3:23:02 PM11/17/09
to
Using Visual Studio 2008, with VSeWSS3, I've created a new empty SharePoint
project (to GAC), then added new item > event receiver to Survey list type.

then added to the ItemAdding the following line of code:

SPUtility.SendEmail(SPContext.Current.Web, false, false,
"m...@domain.xxx", "Test event receiver email", "This message is sent as a
result of the event ItemAdding firing on the survey");

Built and deployed the solution from the menu. I was expecting this to work,
but it's not firing, and in the logs I get:

Error loading and running event receiver
ISFeedbackSurvey.ISFeedbackSurveyEvtItemEventReceiver in ISFeedbackSurvey,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=97efffa28708eee2. Additional
information is below. : Object reference not set to an instance of an object.

and

Event manager error: Could not load file or assembly 'SurveyNotification,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=4884dab2ea11612f' or one of
its dependencies. The system cannot find the file specified.

I've checked the GAC, the dll is there, the SafeControls entry is in the
web.config...

What am I missing?

Funny enough, the coding in ItemDeleting is firing just fine.

Nik

unread,
Nov 18, 2009, 8:38:06 AM11/18/09
to
Did some more investigation, if I put something as simple as

properties.ErrorMessage = "Hitting ItemAdding event override...";
properties.Cancel = true;

it works just fine. Those errors are in fact thrown by SPUtility.SendEmail...

how do I go about using SPUtility? What else needs to be deployed with my
feature?

Nik

unread,
Nov 25, 2009, 9:14:05 AM11/25/09
to
Solved it by using System.Net.Mail instead. Will go back to SPUtility at a
later time to investigate.
0 new messages