Multiple choice technology

We need to stop a user from deleting a document from a document library. In this scenario what would be the correct statements:

  1. Use ItemDeleted Event

  2. Use ItemDeleting Event

  3. Use properties.Cancel = true;

  4. Use properties.Cancel = false;

Reveal answer Fill a bubble to check yourself
B,C Correct answer
Explanation

To prevent a document deletion, you must use the ItemDeleting event (option B), which fires before the deletion occurs and can be cancelled. The ItemDeleted event (option A) fires after deletion is complete, making it too late to prevent. Setting properties.Cancel = true (option C) within the ItemDeleting event handler cancels the deletion operation. Setting it to false (option D) would allow the deletion to proceed, which is the opposite of what we want.