nerdexam
Microsoft

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.

Design and develop advanced Microsoft SharePoint 2013 solutions

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)
  • A
    2% (1)
  • B
    2% (1)
  • C
    90% (43)
  • D
    6% (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.

Apublic class EventReceiver1

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.

Bpublic class EventReceiver1 : SPListEventReceiver

SPListEventReceiver handles list-level events such as list creation or deletion, not item-level operations like add or update within a list.

Cpublic class EventReceiver1 : SPItemEventReceiverCorrect

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.

Dpublic class EventReceiver1 : SPEventReceiverBase

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

#event receivers#SPItemEventReceiver#list events#notifications

Community Discussion

No community discussion yet for this question.

Full 70-489 Practice