locked
Event handler firing for one site but not for another RRS feed

  • Question

  • Hi,

    I have an event handler that is working just fine on a list in one site, but when I bind it to the other list in another site, it binds properly, but never fires. Any suggestion? 

     

    Friday, October 22, 2010 1:47 AM

Answers

  • Hi Malhar,

    I have seen this blog and so many suggestion are there. Can you give the list name in your code and try it. It might be possible that your event handler is not able to collect the right list name.

    Try to use below code

    static void Main(string[] args)
            {

                SPSite site = new SPSite("https://fullsitepathhere");

                SPWeb web = site.OpenWeb();

                SPList list = web.Lists["List Name"];

                list.EventReceivers.Add(SPEventReceiverType.ItemAdded, "NewSaas, Version=1.0.0.0, Culture=neutral, PublicKeyToken=038de5f4e8f782c2, processorArchitecture=MSIL", "NewSaas.saasNew");

                list.EventReceivers.Add(SPEventReceiverType.ItemUpdated,  "NewSaas, Version=1.0.0.0, Culture=neutral, PublicKeyToken=038de5f4e8f782c2, processorArchitecture=MSIL", "NewSaas.saasNew");


                Console.WriteLine("Event Handler Registered!!");

            }

    Let me know the result


    Cheers, Hemendra-MCTS "Yesterday is just a memory,Tomorrow we may never see"
    Monday, October 25, 2010 4:53 AM

All replies

  • Hi Malhar,

    Couple of questions:

    1. How you are bindind

    2. Have you given the list name in your code

    3. How did you implement your event handler on your server

    Please elaborate more so that i can help you out


    Cheers, Hemendra-MCTS "Yesterday is just a memory,Tomorrow we may never see"
    Friday, October 22, 2010 4:35 AM
  • Please check ListTemplateId in elements XML. May be your another list not coming under this list template.
    Regards, Sandip Patil, .Net,Sharepoint Developer www.worldofsharepoint.com
    Friday, October 22, 2010 5:58 AM
  • Hi Guys,

    Thanks for your response.

    Hemendra - http://social.technet.microsoft.com/Forums/en-US/sharepointdevelopment/thread/9c82f869-27de-464b-a8a6-7bbc4fb23446

    this is the link where I posted my code, since initially I thought maybe I was binding incorrectly. Now to bind I am using Oleg's suggested code in the above thread.

     

    Sandip - I am not using element XML I am using the object model.

     

    Thanks for your help guys, this issue has really baffled me.

    Friday, October 22, 2010 5:23 PM
  • Hi Malhar,

    I have seen this blog and so many suggestion are there. Can you give the list name in your code and try it. It might be possible that your event handler is not able to collect the right list name.

    Try to use below code

    static void Main(string[] args)
            {

                SPSite site = new SPSite("https://fullsitepathhere");

                SPWeb web = site.OpenWeb();

                SPList list = web.Lists["List Name"];

                list.EventReceivers.Add(SPEventReceiverType.ItemAdded, "NewSaas, Version=1.0.0.0, Culture=neutral, PublicKeyToken=038de5f4e8f782c2, processorArchitecture=MSIL", "NewSaas.saasNew");

                list.EventReceivers.Add(SPEventReceiverType.ItemUpdated,  "NewSaas, Version=1.0.0.0, Culture=neutral, PublicKeyToken=038de5f4e8f782c2, processorArchitecture=MSIL", "NewSaas.saasNew");


                Console.WriteLine("Event Handler Registered!!");

            }

    Let me know the result


    Cheers, Hemendra-MCTS "Yesterday is just a memory,Tomorrow we may never see"
    Monday, October 25, 2010 4:53 AM
  • Hi,

    I got same problem, how ever I am using Sharepoint webservices.

    regards

     

    Monday, October 25, 2010 9:27 AM
  • Hello malhar,

    Now I could solve the problem on my computer. If you have some validation controls, say to one of your text box, it willl not allow the event to be fired until it is filled. Please check it if you have similar problem.

    regards.

    Monday, October 25, 2010 12:51 PM