event receiver for two or more list type (e.g document library, custom list, links, announcment )
Goal:
I want a event receiver to be triggered when a item is added to all the list type in a site , whether is document library, custom list, links , announcement or what ever
Mm... How i can use a single event receiver for multiple list types
Here you go,
Create a Event receiver, & Navigate to the Elements.xml file,
You'll find similar to something below
EventReceiver1ItemAdded ItemAdded $SharePoint.Project.AssemblyFullName$ EventReceiverName.EventReceiver1.EventReceiver1 10000
Here ListTemplateId="101" denotes the Document Library.
Well do you wanna find the list template id's of Custom List, Picture Library etc.?
Just go to the SPListTemplateType msdn site.
Alright, Back to goal,
Just duplicate the
I want the same event receiver to be triggered for announcement
Then my elements.xml will look like below
EventReceiver1ItemAdded ItemAdded $SharePoint.Project.AssemblyFullName$ MarketInfoUniqueItemPermission.EventReceiver1.EventReceiver1 10000 EventReceiver1ItemAdded ItemAdded $SharePoint.Project.AssemblyFullName$ MarketInfoUniqueItemPermission.EventReceiver1.EventReceiver1 10000
Where ListTemplateId="103" stands for Announcement.
Job done..