views:

806

answers:

1

I have two event recievers setup on a list in 2010.

The first is a ItemAdded reciever that works every time:

<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/"&gt;
  <Receivers ListTemplateId="10000">
      <Receiver>
        <Name>ListItemReceiverItemAdding</Name>
        <Type>ItemAdding</Type>
        <Assembly>$SharePoint.Project.AssemblyFullName$</Assembly>
        <Class>SSW.TipDontRant.Sharepoint.ListItemReceiver</Class>
        <SequenceNumber>10000</SequenceNumber>
      </Receiver>
  </Receivers>
</Elements>

The second is an Email event reciever that I have only preiodicaly got to work.. In the 30-40 attempts to debug the applicaiton I have only had it work in 2 cases.

<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/"&gt;
  <Receivers ListTemplateId="10000">
      <Receiver>
        <Name>EmailReceiverEmailReceived</Name>
        <Type>EmailReceived</Type>
        <Assembly>$SharePoint.Project.AssemblyFullName$</Assembly>
        <Class>SSW.TipDontRant.Sharepoint.EmailReceiver</Class>
        <SequenceNumber>10000</SequenceNumber>
      </Receiver>
  </Receivers>
</Elements>

I have attached to the OWSTimer and the ListTemplateId is indeed correct.

On checking the log as sugested I found the follwoing error:

12/11/2009 17:12:54.01  OWSTIMER.EXE (0x2314)                    0x046C SharePoint Foundation          Monitoring                     nasq Medium   Entering monitored scope (Timer Job job-email-delivery) 7b525bbb-0972-4115-97b1-19b1d94ff8c5
12/11/2009 17:12:54.03  OWSTIMER.EXE (0x2314)                    0x046C SharePoint Foundation          E-Mail                         6873 Warning  An error occurred while processing the incoming e-mail file C:\inetpub\mailroot\Drop\24c6872e01ca7a8500000003.eml. The error was: Object reference not set to an instance of an object.. 7b525bbb-0972-4115-97b1-19b1d94ff8c5
12/11/2009 17:12:54.03  OWSTIMER.EXE (0x2314)                    0x046C SharePoint Foundation          E-Mail                         6871 Information The Incoming E-Mail service has completed a batch.  The elapsed time was 00:00:00.0190038.  The service processed 1 message(s) in total.  Errors occurred processing 1 message(s): Message ID: <B05256D324B3D540853A95FF2AD9B257801F931C81@mooncalf>  7b525bbb-0972-4115-97b1-19b1d94ff8c5
12/11/2009 17:12:54.03  OWSTIMER.EXE (0x2314)                    0x046C SharePoint Foundation          Monitoring                     b4ly Medium   Leaving Monitored Scope (Timer Job job-email-delivery). Execution Time=23.4762559268986 7b525bbb-0972-4115-97b1-19b1d94ff8c5

Its a little dificult to read here, but the important bit I think is:

An error occurred while processing the incoming e-mail file C:\inetpub\mailroot\Drop\24c6872e01ca7a8500000003.eml. The error was: Object reference not set to an instance of an object.. 7b525bbb-0972-4115-97b1-19b1d94ff8c5

Which does not tell me much! I do not think that it an error with my code, as it would throw within Visual Studio. I can confirm that emails sent to a document library work correctly as well.

  1. Has anyone else had these problems?
  2. Has anyone managed to get this to work consitantly?

[UPDATE] I left my code over the weekend, did not touch it at all, and now it is working! This seams to be very flacky on Sharepoints part.

So, I now have the line of my code that is failing (note that I did not get this far before) and it is on a reference to an external assembly for which I have opened another question http://stackoverflow.com/questions/1901817/sharepoint-2010-project-package-cannot-add-a-new-project-output-assembly-to-the

+1  A: 

It looks like this is a bug either in VS2010 Beta 2 or in Sharepoint 2010 beta.

To solve the imediate problem you need to delete the site, deactivate and remove the solution and then reboot your enviroment.

This only happens when you make structural changes to your lists and Event Recieves and only seams to affect the Email Event Reciever...

MrHinsh
My only thought looking at this wierd SharePoint behaviour that resolve itself after a while is that after deploying the list event receiver perhaps an IISRESET is required.
John Liu
John I am pretty sure that one is performed when you do a deployment...
MrHinsh