I have item deleting event receiver on document library. I have folders and files in library.

  • When I delete file event is triggered.
  • When i delete folder event is triggered for folder but not for items inside folders.

How can I trigger event for files inside folder when i delete folder.

  • It doesn't make sense to activate delete event on all sub items. Rather you can handle that inside folder deleting handler. – Amal Hashim Jul 8 '15 at 15:34
  • @AmalHashim so what will be the best solution? 1) one you suggested or 2) do not allow user to delete folder. As we have logic in event receiver which will take long time if we go for approach 1. – Ravi Khambhati Jul 8 '15 at 15:40
  • Inside folder deleting event check if folder has files inside it, in that case call File Delete action (action mean what you want to do in case of file is deleted) – Amal Hashim Jul 8 '15 at 15:41
  • @AmalHashim But what if folder has thousands of item? Will this be the best solution in such situation? – Ravi Khambhati Jul 8 '15 at 15:44
  • What are you trying to achieve at the deleting event ? – JayHell Jul 8 '15 at 17:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.