70-489 · Question #72
You need to implement the notifications for the custom list app named Admin. Which code segment should you add at line ER08?
The correct answer is C. public class EventReceiver1 : SPItemEventReceiver. This question tests which SharePoint base class to inherit when implementing an event receiver that responds to item-level events on a custom list.
Question
You need to implement the notifications for the custom list app named Admin. Which code segment should you add at line ER08?
Options
- Apublic class EventReceiver1
- Bpublic class EventReceiver1 : SPListEventReceiver
- Cpublic class EventReceiver1 : SPItemEventReceiver
- Dpublic class EventReceiver1 : SPEventReceiverBase
How the community answered
(48 responses)- A2% (1)
- B2% (1)
- C90% (43)
- D6% (3)
Why each option
This question tests which SharePoint base class to inherit when implementing an event receiver that responds to item-level events on a custom list.
A plain class with no base class inheritance provides no SharePoint event receiver infrastructure and cannot be registered or fired by the SharePoint event system.
SPListEventReceiver handles list-level events such as list creation or deletion, not item-level operations like add or update within a list.
SPItemEventReceiver is the correct base class for handling item-level events such as ItemAdded, ItemUpdated, and ItemDeleted on a SharePoint list. For a custom list app named Admin that requires notifications triggered by list item operations, inheriting from SPItemEventReceiver provides the necessary overridable event handler methods. This class is specifically designed for synchronous and asynchronous item event handling within a list context.
SPEventReceiverBase is the abstract root base class in the hierarchy and is not intended for direct inheritance in custom event receiver implementations - it lacks item-specific event handler stubs.
Concept tested: SharePoint SPItemEventReceiver inheritance for list item events
Source: https://learn.microsoft.com/en-us/previous-versions/office/sharepoint-server/ms457328(v=office.15)
Topics
Community Discussion
No community discussion yet for this question.