SharePoint EventReceiver tying to a specific Document Library (Custom)

Posted on 2013-08-28
Medium Priority
Last Modified: 2013-08-28
I want to take an event receiver and tie it to a specific Document Library that is created on about 10 out of 20 sites called "ApprovedDocuments". The eventReceiver works fine, however, when I modify the elements.xml from   <Receivers ListTemplateId="101"> to
<Receivers ListUrl="Lists/ApprovedDocuments"> from instructions on how to tie to a specific list, I get the follwing error when I deploy the testDB

Error      1      Error occurred in deployment step 'Activate Features': <nativehr>0x80070002</nativehr><nativestack></nativestack>
            0      0      TestDB

Any ideas I can look for in this, or another way to tie a eventreceiver to a specific list?
Question by:BKennedy2008
  • 2
LVL 44

Accepted Solution

Rainer Jeschor earned 2000 total points
ID: 39445556
I think the url is wrong as a document library would probably not being created under the lists folder hence the property should look like
<Receivers ListUrl="ApprovedDocuments" > 

Open in new window

Or you use the programmatic way in the feature event receiver:
BTW, which SharePoint version and edition and which Visual Studio version?


Author Comment

ID: 39445635
VS2010, I tried the first solution with no luck. I will work through the second solution.

Author Closing Comment

ID: 39446229
Thanks again - Next time I will hire you as a consultant....

Just wrapping it with : If (properties.List.Title = "Approved Documents") Then

do something....


Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

SingleRun is a tool that ensures that only one instance of an application is started, running it again brings the application to focus.
I tried to use the SharePoint app to Import a Spreadsheet and import an Excel sheet into a Team site made in SharePoint 2016. But that just resulted in getting an error message 'Unknown Error'...
Free Data Recovery software is an advanced solution from Kernel Tools to recover data and files such as documents, emails, database, media and pictures, etc. It supports recovery from physical & logical drive after a hard disk crash, accidental/inte…
Watch the video of Kernel Migrator for SharePoint, which demonstrate the process easily of migration from SharePoint to SharePoint, OneDrive for Business & Google Drive servers, Public Folder to SharePoint, File Server to SharePoint. The tool has va…

587 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question