Answered by:
attach event receiver to specific List definition

Question
-
Hello ,
- I have created a custom List Definition (Type=10000);
- Then I create a list instance from list definition .
- I have create an Event Receiver , And Set <Receivers ListTemplateId="10000" .
- I create a feature (Scope: Site) . and add previous elements to it .
- I activate the feature . Then When I add an item in the list , the event receiver works fine.
If I try add an item to another list with a different list definition , the event receiver works too .
So what is wrong ? And How can run event receiver with a specific list definition ?
Thanks
ASk
Thursday, November 29, 2012 10:27 AM
Answers
-
Check this link out: http://msdn.microsoft.com/en-us/library/ff398052%28v=vs.100%29.aspx
- Proposed as answer by Hemendra Agrawal Thursday, November 29, 2012 10:34 AM
- Marked as answer by Kelly Chen 2012 Tuesday, December 4, 2012 1:47 AM
Thursday, November 29, 2012 10:31 AM -
Depends on your needs. If you add it in site scope, all lists in the site collection using your definition will trigger the event receiver. Use Web scope to trigger the receiver only within the parent site and its subsites.
Kind Regards
Bjoern
http://spviking.com
Twitter: Follow @bjoern_rapp- Marked as answer by Kelly Chen 2012 Tuesday, December 4, 2012 1:48 AM
Thursday, November 29, 2012 11:28 AM
All replies
-
Check this link out: http://msdn.microsoft.com/en-us/library/ff398052%28v=vs.100%29.aspx
- Proposed as answer by Hemendra Agrawal Thursday, November 29, 2012 10:34 AM
- Marked as answer by Kelly Chen 2012 Tuesday, December 4, 2012 1:47 AM
Thursday, November 29, 2012 10:31 AM -
Hi
I too was leaning towards the suggestion in the link provided by Khem, but I'm not sure since you are referring to "list definition" while the linked suggestion works on an instance of a list.
Kind Regards
Bjoern
http://spviking.com
Twitter: Follow @bjoern_rappThursday, November 29, 2012 10:43 AM -
Hello ,
Thanks for ur reply .
Must I add event reciever web scope feature or I Can add it in site scope feature ?
ASk
Thursday, November 29, 2012 11:01 AM -
Depends on your needs. If you add it in site scope, all lists in the site collection using your definition will trigger the event receiver. Use Web scope to trigger the receiver only within the parent site and its subsites.
Kind Regards
Bjoern
http://spviking.com
Twitter: Follow @bjoern_rapp- Marked as answer by Kelly Chen 2012 Tuesday, December 4, 2012 1:48 AM
Thursday, November 29, 2012 11:28 AM