I created a simple event receiver of SPEmailEventReceiver. But while creating it, Visual Studio did not ask me on which list/library it needs to be attached. In PowerShell I know that I can get event receivers like this.

$site = Get-SPSite -Identity "SITE"
$web = $site.RootWeb
$list = $web.Lists["LIST/LIBRARY"]
$list.EventReceivers | Select assembly, name, type

But how can I check where the SPEmailEventReceiver event receiver is attached?

Update 1:

I have used ListTemplateId="101" while defining the event receiver so this should be applicable to all lists/libraries, right? For this how to know check where the event receiver is attached?

2 Answers 2


You inherit a SharePoint site. Some of the lists do odd things and you want to find out if there are there event receivers on the list. If you have access to Power Shell and the SharePoint servers, you can use the following Power Shell code to find out.

Code :

$GC = Start-SPAssignment            
$Site =  $GC | Get-SPSite http://yourserver/sites/yoursite            
$Web = $Site.Rootweb            
$Web.Lists |            
   Where {$_.EventReceivers.Count -gt 0} |            
   Select Title,EventReceivers |            
Stop-SPAssignment $GC

Code For SharePoint 2007 or 2010 :

$Site = New-Object Microsoft.SharePoint.SPSite(http://yourserver/sites/yoursite)                        
$Web = $Site.Rootweb                        
$Web.Lists |                        
   Where {$_.EventReceivers.Count -gt 0} |                        
   Select Title,EventReceivers |                        

You could even start at the farm (root) level and drill down to applications, site collections, sites and documents to see each event receiver!

  • So, the above code will give me all the event receivers for all the lists/libraries for the site? Also where do Email Event Receivers get attached? Also please see the edit to my question for more detail.
    – Naveen
    Jan 8, 2016 at 4:49
  • Yes, This code will give you all the receivers which is connected all the lists in sites. you can attacjed email event receiver to document library as well as lists.
    – Dipen Shah
    Jan 8, 2016 at 5:08
  • So if I have ListTemplateId="101" in my elements.xml then where will I see the event attached to? Will it be shown for all lists/libraries?
    – Naveen
    Jan 8, 2016 at 16:44

You can add event receiver in element.xml for library as below.

--> It will not seen for all site and sub site. It will applied on only one list instance which is mention by user in Name property of below code.


 <?xml version="1.0" encoding="utf-8"?>
    <Elements xmlns="http://schemas.microsoft.com/sharepoint/">
      <Receivers ListTemplateId="101">
            <Assembly>Test.eventreceiver.business, Version=, Culture=neutral, PublicKeyToken=29192015d9531c48</Assembly>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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