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 a problem with my eventreceiver. It is set to fire on updating item from a list, and works very good when I update that item from Sharepoint's web UI. However I have some code that goes through a list and updates it with new values, and this for some reason doesn't fire the event. Here's the updating code:

            SPListItemCollection listItemCollection = list.GetItems(query);

        foreach(SPListItem item in listItemCollection)
        {

            int itemID = matches.FindIndex(match => match.WebID == item["vG_ID"].ToString());
            if (itemID != -1)
            {
                if (item["vG1"].ToString() != matches[itemID].TeamLeftScore.ToString() ||
                    item["vG2"].ToString() != matches[itemID].TeamRightScore.ToString())
                {
                    item["vG1"] = matches[itemID].TeamLeftScore;
                    item["vG2"] = matches[itemID].TeamRightScore;
                    item.Update();
                }
            }
        }

How do I fix that?

share|improve this question
1  
The ItemUpdated event should fire in this instance provided any updates are done. Are you sure it's not firing? Have you tried to set a breakpoint and attach to both the process doing the update and owstimer? –  Per Jakobsen Jul 30 '12 at 12:07
    
Yes, it's definitely not firing. I don't know what should I look at since the event has been programmed by another person. –  Rafał Saltarski Jul 30 '12 at 12:18
1  
If you haven't tried to set a breakpoint in it, how do you then know that it isn't firing and failing? If it really isn't firing are you code running in a context where the event receiver can be loaded? And is you code updating anything? –  Per Jakobsen Jul 30 '12 at 12:34
    
I have the code here and I have set breakpoints and attached to processes. My code is updating everything properly, It's just that the event's clearly not firing at all. –  Rafał Saltarski Jul 30 '12 at 12:37
    
Ok, well, turns out there was some uncaught exception in my code's execution and that prevented the event from firing, for some reason. Thank you for your help –  Rafał Saltarski Jul 30 '12 at 12:52

Your Answer

 
discard

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

Browse other questions tagged or ask your own question.