Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I have an event reciever with ItemDeleting action, in which i try to delete an item from another list (I cant realy use cascade delet behavior here, I need to do some stuff that requires the receiver). The problem is, the code deleting the item executes for like 2 minutes, doesnt matter if I use SPListItem.Delete() or ProcessBatchData(). The receiver runs synchronously (thats actually a second problem - I can't change it to run async, which should be default...). The same code (item deleting) runs normally (fast) in a test, so I dont think there is anything wrong with it. Just posting Elements.xml of my receiver, hoping maybe this will help to see the issue:

<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <Receivers ListUrl="Lists/MyList">
      <Receiver>
        <Name>SomethingItemDeleting</Name>
        <Type>ItemDeleting</Type>
        <Assembly>$SharePoint.Project.AssemblyFullName$</Assembly>
        <Class>My.Class.SomethingReceiver.SomethingReceiver</Class>
        <SequenceNumber>10000</SequenceNumber>
      </Receiver>
  </Receivers>
</Elements>

Edit: The code that executes so long is basically

_web.ProcessBatchData(batch);

Where batch is:

"<?xml version=\"1.0\" encoding=\"UTF-8\"?><ows:Batch OnError=\"Continue\"><Method><SetList Scope=\"Request\">e8bccd77-2a29-49f4-81b9-a7909babd3b6</SetList><SetVar Name=\"ID\">2487</SetVar><SetVar Name=\"Cmd\">Delete</SetVar></Method></ows:Batch>";

The same code outside the receiver executes in like 2 seconds. The same is when I run SPListItem.Delete(). The list from which the item is being deleted contains about 50 items (they are in 2-level folder hierarchy) and has no event receivers of its own

share|improve this question
    
Please post the item deleting code as well... –  Arsalan Adam Khatri Dec 17 '12 at 15:03

1 Answer 1

up vote 0 down vote accepted

I have the same issue when my list have lookup fields with restriction on delete. ULS write that web is locked. Removing restrinction from lookup field fix this issue. I just don't know if this situations is as yours.

share|improve this answer
    
Ok, so on the list that caused the problems I had one more lookup, to some different list (X), where the 'cascade delete' behavior was selected. Removing it actualy helps, so thanks for the tip. I just dont know why this was causing a problem, if I understand correctly - when I delete an item form X, every item on my problematic list which has a lookup to that item will be deleted as well, but nothing like this occurs in my case –  matt137 Dec 18 '12 at 11:22

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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