Delete Event Receiver Sharepoint 2013

Listing Results Delete Event Receiver Sharepoint 2013

About 14 results and 8 answers.

2013 - deleting event receiver programatically using c#

2 hours ago

  • 3 Answers 3 3 Answers 3 1 It's mostly likely because you already have an instance of the SPList (from another context) before you try to execute the deletion of an EventReceiver. That's why the ThreadAbortionException is thrown. Instead of sending in the list, send its name instead and get the list inside the RunWithElevatedPrivileges codeblock. private void RemoveEventReceiver(string listName, bool isRemove) { // No need to continue if it's FALSE if (isRemove) return; SPSecurity.RunWithElevatedPrivileges(() => { using (var site = new SPSite(SPContext.Current.Site.ID)) { using (var web = site.OpenWeb()) { // Get the list with elevated permissions var list = web.Lists.TryGetList(listName); try { web.AllowUnsafeUpdates = true; foreach (SPEventReceiverDefinition eventReceiver in list.EventReceivers) { if (eventReceiver.Type == SPEventReceiverType.ItemUpdating) { eventReceiver.Delete(); } } // Update the list after the iteration is complete. list.Update(); } catch(Exception ex) { //... } finally { // Remember to set AllowUnsafeUpdates to false again when you're done. web.AllowUnsafeUpdates = false; } } } }); } Follow answered Jun 30 '15 at 12:44 user2536user2536  |  2 I would try the following: Get the List again from the elevated Web instead of the instance you pass to this method. Try searching your eventreceiver additional by assembly or classname to make sure you don't delete some SharePoint internal Receiver. finally{ web.AllowUnsafeUpdates = false;} Follow answered Jun 30 '15 at 12:22 Gwny 1,22411 gold badge77 silver badges1616 bronze badges  |  0 Also, it looks to me like you are trying to modify a collection while iterating through it. I would try a regular for/next loop going from (SPList.EventReceivers.Count - 1) to 0. And you do need to get the list again from an elevated web. Which you get from an elevated site (I always indicate the SystemAccount token specifically for clarity): string ListName="<Title of List>"; SPSecurity.RunWithElevatedPrivileges(delegate () { using (SPSite site = new SPSite(web.Site.ID, SPUserToken.SystemAccount)) { using (SPWeb elevatedWeb = site.AllWebs[web.ID]) { elevatedWeb.AllowUnsafeUpdates = true; try { SPList list = elevatedWeb.Lists[ListName]; int numEventReceivers = list.EventReceivers.Count; int topIndexOfEventReceivers = numEventReceivers - 1; for (int i=topIndexOfEventReceivers;i>-1;i--) { SPEventReceiverDefinition eventRecieverDefinition = list.EventReceivers[i]; eventRecieverDefinition.Delete(); } list.Update(); } finally { elevatedWeb.AllowUnsafeUpdates = false; } } } }); Follow answered May 18 '18 at 18:44 towkneed 4144 bronze badges  | 
  • Not the answer you're looking for? Browse other questions tagged 2013 2010 event-receivers or ask your own question. Not the answer you're looking for? Browse other questions tagged or .

Show more

See More

Remote Event Receivers - cannot delete them

2 hours ago Oct 15, 2013 . Developing Apps for SharePoint 2013 https: ... Use the AppUninstalled event receiver to remove them, probably best practice to clean up after yourself but doing work in the App Event Receivers is a bit of a minefield itself. Change the deployment so that the App deployment supports Upgrade as well as Remove / Install. This will need support ...

Show more

See More

Add, Modify or Delete List Event Receivers with

5 hours ago Mar 22, 2012 . Delete Event Receivers. Run the following to delete a specific event receiver (in this example ItemDeleting event receiver) Add-PSSnapin Microsoft.SharePoint.PowerShell –erroraction SilentlyContinue $web = Get-SPWeb -Identity http://...

Show more

See More

How to delete the deployed Event Receiver in Sharepoint

9 hours ago Jun 01, 2012 . private void DeleteEventReceiverFromAList(string siteUrl) { using (SPSite site = new SPSite(siteUrl)) { using(SPWeb web = site.OpenWeb()) { try { SPList list = web.Lists["myList"]; if (list != null) { string className = "EventReceiverClass"; string asmName = "EventReceiverAssemblyName, Version=1.0.0.0, Culture=neutral, PublicKeyToken=a865f0ecc234ea51"; web.AllowUnsafeUpdates = …

Show more

See More

Chris O'Brien: Add/delete and list Remote Event Receivers

11 hours ago Jan 26, 2014 . Adding a new Remote Event Receiver. The function below adds a remote event receiver to a named SharePoint list. (N.B. Note that all the functions below require a valid ClientContext object to be passed in – see the Prerequisites section towards the end of this post for more details.)

Show more

See More

Delete event receiver from a SharePoint list

8 hours ago Jan 16, 2011 . Delete event receiver from a SharePoint list. In my previous post, we saw how we added an event receiver to a list. Now, we will see how to delete the existing event receiver on a list. private void DeleteEventReceiverFromAList (string siteUrl) { using (SPSite site = new SPSite (siteUrl)) { using (SPWeb web = site.OpenWeb ()) { try { SPList list = web.Lists ["myList"]; if (list != null) { string …

Show more

See More

Add-Remove-Get Event Receivers in SharePoint with

4 hours ago Feb 12, 2014 . SharePoint PowerShell to Remove Event Receiver: You can also delete a particular event receiver by its ID. Here is an example of remove

Show more

See More

Creating Simple Event Receiver in SharePoint 2013

12 hours ago

Show more

See More

Use remote event receivers in SharePoint Microsoft Docs

11 hours ago Replace event receivers implemented using fully trusted code solutions. In fully trusted code solutions, you can run event receivers on the SharePoint server. In the new SharePoint Add-in model, because you cannot run the event receiver on the SharePoint server, you need to implement a remote event receiver on a web server.

Show more

See More

Event receivers and list event receivers in the SharePoint

4 hours ago
As a rule of a thumb, we would like to provide the following high-level guidelines for creating event receivers. 1. The service end point that implements a event receiver must be accessible by anonymous users. 2. Event receivers added to the Add-in web allow you to return an access token. 3. Event receivers added to the host web will return access token, if they are applied from app context using app access token and operation in the host web is end user driven (ItemAdded etc.) 4. AppInstalled event …

Show more

See More

Event Receivers in SharePoint: A complete guide

7 hours ago
While developing any application we need to handle some events. For example, when a new item is added to a list, we may need to perform some action like say, notifying the person who created the list item, or modifying the dependent entries in some other location etc. Handling of such events is facilitated by event receivers. We have many SharePoint event receiver classes in order to handle variety of events.

Show more

See More

Remove orphan Event handlers in SharePoint Lists c

1 hours ago Mar 19, 2013 . Recently we had to migrate at a client a site collection from SharePoint 2007 towards SharePoint 2010 (yeap, a lot of people are still doing this). Not having all the information at hand, the administrator performing the migration, was unaware that one assembly, which was manually registered in GAC was actually containing a Event Receiver

Show more

See More

SharePoint 2010 - Event Receiver still working even if i

1 hours ago Aug 17, 2012 . If they are attached multiple times, just delete them using a powershell. Check Event receivers using powershell:-Add-PsSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue $spWeb = Get-SPWeb -Identity "sitename" $spList = $spWeb.Lists["yourlistname"] $spList.EventReceivers | Select assembly,name

Show more

See More

Question: "The request was cancelled by an event receiver

4 hours ago Hey Reddit, hope all is well. I've been trying to clear out space in my OneDrive because I've recently exceeded my maximum storage. Today I've been receiving a message that says "the request was cancelled by an event receiver" when I tried to delete a file (video).

Show more

See More

Frequently Asked Questions

  • What are remote event receivers in SharePoint?

    In an SharePoint Add-in model scenario, event receivers are created outside of SharePoint inside a web service and registered with SharePoint. These are called as Remote Event Receivers (RER). In this scenario, the event receiver code runs on the web server where the web service is hosted.

  • How to create a SharePoint 2013 event receiver in Visual Studio 2013?

    Open Visual Studio 2013 and create an Empty SharePoint Project. Enter site URL and select Deploy as a farm solution and click Finish. Open Solution Explorer and add a new item. Select event receiver and enter the title of the event receiver. Click the Add button.

  • How to configure SharePoint add-ins with SharePoint event receivers?

    Configure your add-in on first run using the AppInstalled event to set up various SharePoint objects or additional event receivers that your add-in works with. Replace event receivers implemented using fully trusted code solutions. In fully trusted code solutions, you can run event receivers on the SharePoint server.

  • What is duduplicate instances of SharePoint event receivers?

    Duplicate instances of SharePoint event receivers is a known issue. They share a common assembly with different sequence numbers. So they fire twice. To Add event receivers with SharePoint list Programmatically with C#, refer: SharePoint add event receiver to list Information Technology Professional with Two decades of SharePoint Experience.

  • How to create a SharePoint 2013 event receiver in Visual Studio 2013?

    Open Visual Studio 2013 and create an Empty SharePoint Project. Enter site URL and select Deploy as a farm solution and click Finish. Open Solution Explorer and add a new item. Select event receiver and enter the title of the event receiver. Click the Add button.

  • How to add event receiver to SharePoint list with PowerShell?

    Let’s add event receiver by creating the definition in PowerShell: Alternatively, in SharePoint to add event receiver to list with PowerShell: $Web = Get-SPWeb "http://sharepoint.crescent.com" $Assembly = "Crescent.DocRestrict, Version=1.0.0.0, Culture=neutral, PublicKeyToken=677b45b1314c252c"

  • How do I update SharePoint 2013 without firing the event receiver?

    Microsoft.SharePoint.dll Right-click on the project, select Add and click on New Item. In the templates pane, select Class. Enter the Name as EventFiring and then click OK. Hit F5. The item is updated successfully without firing the item updated event receiver.

  • How to register event receivers with target list or library?

    We usually use C# console application or feature activation code to register event receivers with the target list or library in SharePoint. At times, we may have to handle event receiver associations explicitly.

Have feedback?

If you have any questions, please do not hesitate to ask us.