locked
How to attach Item Added Event Handler to specific document library ? RRS feed

  • Question

  • I have created event handler on ItemAdded. I am facing trouble in attaching to specific document library.

    I have tried giving ListURL in elements.xml but did not work. Error while activating feature.

    But if i tried ListTemplateID=101 its working fine. But the problem is it is attaching to all document libraries in the site.

    I am using Sharepoint 2010 and Visual Studio 2010.

    Any help will be appreciated .

    Thanks in Advance.

     

     

    Wednesday, February 1, 2012 4:24 PM

Answers

  • Yes ListUrl did not work. Problem solved my self. Attaching is achieved using code and the library is recreated to solve.
    • Marked as answer by Tech-Fun Wednesday, February 1, 2012 11:39 PM
    Wednesday, February 1, 2012 11:38 PM

All replies

  • Try This:
    http://www.learningsharepoint.com/2010/06/27/creating-event-receiver-in-sharepoint-2010/

    The only think that you will have to do different is instead of a custom list you will have to select a document library & Sure your logic ;)...


    Happy Sharepointing... Regards SPTECH07
    Wednesday, February 1, 2012 4:39 PM
  • Hi Geetanjali,

            Thanks for responding. My logic perfectly works. For custom list it works. I am not sure exactly whats the difference between custom list and document library of infopath forms published document library.

     

           For some reason its not working. I have done the same approach which is in your link only difference is in the link it is sandbox solution for custom list. My solution is Farm solution for document library.

     

         I appreciate your response.

    Wednesday, February 1, 2012 5:12 PM
  • Have you tried the ListUrl with exact syntax like this ?

    "Lists/Shared Document"

    Replace the Shared Document with your document library


    Please let me know if my post was helpful.

    Wednesday, February 1, 2012 5:42 PM
  • Yes ListUrl did not work. Problem solved my self. Attaching is achieved using code and the library is recreated to solve.
    • Marked as answer by Tech-Fun Wednesday, February 1, 2012 11:39 PM
    Wednesday, February 1, 2012 11:38 PM
  • SharePoint Event Handlers Manager allows you to browse, add, edit and remove SharePoint event handlers from any list or web. This SharePoint solution provides two features that enables admins to play with event handlers from within SharePoint interface.


    http://code.google.com/p/sharepoint-eventhandlers-manager/


    Nitin Gupta SharePoint Consultant

    Friday, February 10, 2012 6:14 AM