1

I have been struggling with a small but irritating problem for a while now and suddenly I ran out of ideas.

I have implemented an email event receiver in Sharepoint 2010. The event receiver creates folders and extracts all attachments when an email is received. Each email is then represented by a folder that contains the email as an eml file and the attachments as files.

Now to the problem. If a user sets up alerts for this library he/she will get an alert for each of the attachments which could be something like 10 alerts just for one email. We only want to send alerts for the eml file. If this would have been an ordinary event receiver then I would have used

this.EventFiringEnabled = false;    
//do stuff    
this.EventFiringEnabled = true;

but SPEmailEventReceiver does not inherit the same class as an ordinary event receiver. In fact the SPEmailEventReceiver is called form a completely different thread. How do I solve this?

1 Answer 1

0

Are you updating the item multiple times in your code? if this is the case try calling item.SystemUpdate() instead, every time that you don't want an alert to be sent.

Hope this helps

Renzo

1
  • That does not seam to work. This is the code I use for adding a file. Could the adding of the actual file trigger an alert? SPFile file = list.RootFolder.Files.Add(folder, attachment.ContentStream); SPItem item = file.Item; SetItemProperties(message, item); item.SystemUpdate();
    – Andreas
    Commented Nov 7, 2012 at 23:35

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.