I am using SP2013 On Prem. I use a third party solution that deploys custom lists to a site when activated. I need to remove the SPListItem ItemDeleting event receiver from this list, delete some items, and then re add this event receiver. This is in QA and we need a way to purge items during testing and the vendors event handler prevents this. This custom action will be used by 2 or 3 people in a non production farm.
I am able to add/remove EventReceivers(ER) using powershell without a problem but in C# it is not so clear to me how to add the ER back!
Prior to removal I store the Assembly, Class, Type and Name into a text file. In my AddEventReceiver function I want to retrieve these from the text file (easy part) and then readd the event handler to the list. I could always deactivate and reactivate the feature but I'm hoping for something more elegant (?).
Can someone show me how this can be accomplished?