gunjandatta / sprest

An easy way to develop against the SharePoint 2013/Online REST api.
https://dattabase.com
MIT License
77 stars 16 forks source link

How to remove event receiver #288

Closed enti333 closed 2 years ago

enti333 commented 2 years ago

Hello. Is possible with this library to remove event receivers? Of course with same user which add event receiver? Thanks

gunjandatta commented 2 years ago

I wrote a blog post on the REST API and event receivers.

https://dattabase.com/blog/add-an-event-receiver-using-rest

Please let me know if this answers your question, and please close this issue if it does. Thanks for using the library.

gunjandatta commented 2 years ago

I am going to update the blog post to include removing event receivers. I'll update you when I do this.

enti333 commented 2 years ago

Hello. Thank you very much. I have checked your blog and it was working for me to add an event receiver but I have didn't find how to correctly to remove it or Update for example the URL of the receiver. Thank you

gunjandatta commented 2 years ago

I just updated the post to include the delete option.

// Get the list, but do not execute a request to the server
var list = new $REST.List("[Name of the List]");

// Remove the event receiver
list.EventReceivers("[Guid]").delete().execute(
    // Success
    function(er) {
        // The event receiver was removed successfully
    },

    // Error
    function(ex) {
        // The event receiver was not removed
        // See the ex for the response
    }
);
gunjandatta commented 2 years ago

Let me know if you have any other questions/issues.

enti333 commented 2 years ago

Thank you very much for this. I will test this and let you know if it is working.:) Many Thanks:)

gunjandatta commented 2 years ago

Please close this issue if it answers your question.

enti333 commented 2 years ago

THank you very much it is working!:)Thanks