ItemUpdating called twice after ItemAdded in event receiver

Posted by Jason on Stack Overflow See other posts from Stack Overflow or by Jason
Published on 2012-04-04T16:05:44Z Indexed on 2012/04/04 17:29 UTC
Read the original article Hit count: 198

Filed under:

I've created an event receiver to handle the ItemAdded and ItemUpdating events on a document library in SharePoint 2010.

I've encountered a problem where when I add a document to the library (e.g. by saving it back from Word) the ItemAdded method is correctly called however this is then followed by two calls to ItemUpdating. I have removed all code from my handlers to ensure that it's not something I'm doing inside that is causing the problem. They literally look like:

public override void ItemUpdating(SPItemEventProperties properties)
{
}

public override void ItemAdded(SPItemEventProperties properties)
{
}

Does anyone have a solution to this issue?

Here is my elements.xml file for the event receiver:

<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <Receivers ListTemplateId="101">
      <Receiver>
        <Name>DocumentsEventReceiverItemUpdating</Name>
        <Type>ItemUpdating</Type>
        <Assembly>$SharePoint.Project.AssemblyFullName$</Assembly>
        <Class>My.Namespace.DocumentsEventReceiver</Class>
        <SequenceNumber>10000</SequenceNumber>
        <Synchronization>Synchronous</Synchronization>
      </Receiver>
      <Receiver>
        <Name>DocumentsEventReceiverItemAdded</Name>
        <Type>ItemAdded</Type>
        <Assembly>$SharePoint.Project.AssemblyFullName$</Assembly>
        <Class>My.Namespace.DocumentsEventReceiver</Class>
        <SequenceNumber>10000</SequenceNumber>
        <Synchronization>Synchronous</Synchronization>
      </Receiver>
  </Receivers>
</Elements>

© Stack Overflow or respective owner

Related posts about sharepoint2010