1

I am working on sharepoint server 2013. and i have developed an event receiver which fires when lists items are updated. now i define the following setting inside the elements.xml for my solution:-

 <Receivers ListUrl="Lists/Issue Manage">

so that the event receiver will only fire on the lists which have the following url Lists/Issue Manage. Then i try deploying the solution using visual studio 2012, but i got the following error:-

Error 1 Error occurred in deployment step 'Activate Features': The list "Lists/Issue Manage" doesn't exist. Please fix the ListUrl attribute. 0 0 CustomerSitesER

now i changed the feature scope from "Web" (which is the default) to "Site" , and try to re-deply the solution , where the solution got deployed without errors. so my question is why i can not use the ListURL when the solution scope is defined as Web?

second question now when i define the feature scope as Site the solution was deployed successfully, but the event receiver was fired on all the lists even the lists that does not have the following url ListUrl="Lists/Issue Manage". so not sure why this is happening ? as i know defining ListURL inside the feature's element.xml file should restrict the event receiver to got fired on the related lists only. but seems this is not the case.

Thanks

5
  • 1
    this statement is wrong "only fire on the lists which have the following URL Lists/Issue Manage," <Receivers ListUrl="Lists/Issue Manage"> only run on one list that has this path listURL path Commented Oct 12, 2016 at 0:32
  • @M.Qassas i did not get your point ? now all the lists inside any site can be accessed from the following url "/lists/" so defining "list/Issue Manage" means to restrict the event receiver on all the list that can be accessed from "/lists/issue mnage" is this correct ?in all ways the event receiver is firing on all the lists.. so what is the reason ?
    – John John
    Commented Oct 12, 2016 at 1:02
  • this "list/Issue Manage" is the list path for a specific one list Commented Oct 12, 2016 at 1:04
  • @M.Qassas but i have many subsites which have a list that can be accessed using "list/issue manage" ,, why you are assuming that i can only have one list with unique sub-url.. in my case i have 10 sub-sites and each sub-site have a list with the following url "servername/subsitename/list/Maage issue" ... in all ways why the event receiver is firing on all the lists ??
    – John John
    Commented Oct 12, 2016 at 1:08
  • Should you join at this chat.stackexchange.com/rooms/46670/… to discuss in details Commented Oct 12, 2016 at 1:36

1 Answer 1

2

There seems to be some discrepancy. The error you are getting shows the Url as Lists/Risk Issue whereas the Url present in elements.xml file is Lists/Issue Manage.

ListUrl attribute works for Web based scopes and hence it will fire the events in all lists present in subsites where the feature is activated. Finally ListUrl attribute is ignored if scope of feature is changed to Site. See Event Receiver Firing for all Lists - even when ListUrl is set for more information.

11
  • Sorry i wrongly typed the list URL. so the list url is "lists/Issue Manage". first question now in my case i set the scope of the solution as "Web" be selecting this from the Scope dropdown list , and i define the following inside the element.xml "<Receivers ListTemplateId="101">" this mean that the event receiver should only work on document libraries.. but i tried adding an issue tracking item and the event receiver got fired!.
    – John John
    Commented Oct 12, 2016 at 12:31
  • second point now in my case the lists have the following display name "Manage" while their urls are "Issue Manage" as i have rename the lists long time ago (from "Issue Manage" to "Manage" using the UI).. so their names are different that their urls,, now when i use ListURL should i include the display name "Manage" or the url "Issue Manage". third point now regardless of using ListURL or ListTempleteid both is going to fire the event receiver for all the lists (so restricting the ER using these approaches are not working)...so what is the reasons?
    – John John
    Commented Oct 12, 2016 at 12:31
  • May I suggest you to try this on a fresh site collection? Commented Oct 12, 2016 at 12:42
  • additional note now i have also tried to specify the scope inside the elements.xml as follow ""<Receivers ListTemplateId="101" Scope="Web"> but still the event revicer will get fired on all the lists
    – John John
    Commented Oct 12, 2016 at 12:43
  • 1
    If that is the case you can programatically attach the event with a particular list. Commented Oct 12, 2016 at 13:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.