We want to prevent users from deleting top level folders in a document library. We created an event receiver on ItemDeleting that checks if the item type is a folder and if the path is the top level, if so it cancels the event.

public override void ItemDeleting(SPItemEventProperties properties)
    //Boilerplate code and other logic not shown
    errorMsg = "Delete of top level folders is not allowed.";
    properties.ErrorMessage = errorMsg;
    properties.Status = SPEventReceiverStatus.CancelWithError; 
    properties.RedirectUrl = "/_layouts/OurCompany/CustomError.aspx?edrmsMsg=" + errorMsg;

This works fine from the GUI however it appears it doesn't work so well from Explorer view. When a user tries to delete a top level folder from Explorer view the event receiver cancels the folder deletion but still allows SharePoint to delete all items inside the folder. We are guessing that SharePoint is not transactional in its deletion of child / nested items.

Is there any way to fix the event receiver to block the deletion of child / nested items, or is there another way to implement our business requirement?

  • Does event receiver fires when you delete any items separately using Explorer view?
    – Suren
    Oct 23, 2013 at 12:23
  • Yes the ItemDeleting event receiver does fire both when items and folders are deleted via Explorer view
    – JohnC
    Oct 24, 2013 at 3:20
  • @JohnC did you ever find a solution to this problem?
    – Submits
    May 7, 2015 at 15:10
  • No, we didn't pursue it further, we abandoned this approach. If you follow the links in @suren's answer there is a suggestion to use workflow. If someone reports that this works I will accept that answer.
    – JohnC
    May 7, 2015 at 18:51
  • How annoying. I have the same problem where in Explorer view the event fires but cancelling the event does not work. The workflow approach suggested in the link is far from ideal, but perhaps the only way to get around this issue. Thanks.
    – Submits
    May 8, 2015 at 14:28

1 Answer 1


I think event receiver will not fire when do any action in Explorer view. Please refer the following links for workaround.



  • 1
    Not correct, item events do fire for actions in Explorer view, at least for SP 2010 SP2.
    – JohnC
    Oct 24, 2013 at 3:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.