Traitée About processing the document two times in ItemUpdated

  • mercredi 23 mai 2012 18:37
     
     

    Hi!

    I have an event receiver where I intercept the ItemUpdated synrchronously.

    I use that event because it's the only one that works when the user uses the UNC approach to add  a document (I change the file name there).

    The problem is that this event is triggered many times (e.g. if you check in). Can I set a kind of parameter to avoid it? I tried:

    String strNewField = "<Field Type=\"Text\" Hidden=\"TRUE\" DisplayName=\"My field\" ResultType=\"Text\" ReadOnly=\"False\" Name=\"1\"> </Field>";
    item.Fields.AddFieldAsXml(strNewField);

    and then

    if (item.Fields.ContainsField("MyField") )
    {
    return;
    }

    but ContainsField always return true although it's the first time....

Toutes les réponses