Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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?

share|improve this question
add comment

1 Answer

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

share|improve this answer
    
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 Nov 7 '12 at 23:35
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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