Timeline for Best approach to re-use an Event receiver among multiple subsites and multiple lists
Current License: CC BY-SA 3.0
20 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Oct 10, 2016 at 1:23 | vote | accept | John John | ||
Oct 7, 2016 at 12:04 | comment | added | Juan Pablo Pussacq Laborde | Simply asociate the event receiver to the content type like asociarEventosGovernance. | |
Oct 7, 2016 at 0:18 | comment | added | John John | now currently i have created/deploy the event receiver to a single subsite.. my question is how i can have a single event receiver which is attached to the content type (instead of being attached to the subsite) so it will be applied to all the subsites at once.. hope this clarify what i am trying to achieve? thanks | |
Oct 7, 2016 at 0:18 | comment | added | John John | now i have a site collection and inside this site collection i have 11 sub-sites. and inside each sub-site i have an issue tracking list. and all the issue tracing lists share the same site content type. now each sub-site have its own user group which store the related sub-site managers. so the purpose of the event receiver is to check if the user who created an item inside the subsite is part of the subsite user group, and if so to set a column names "Important" to "Yes".. | |
Oct 6, 2016 at 16:58 | comment | added | Juan Pablo Pussacq Laborde | Can you explain briefly what should you do your event handler? Functionally speaking ... | |
Oct 6, 2016 at 16:45 | comment | added | John John | :jpussacq i did not get your latest comments ? what do u mean exactly? thanks | |
Oct 6, 2016 at 16:31 | comment | added | Juan Pablo Pussacq Laborde | I do not understand why you talk of multiple lists as in the event you are in the congtexto from a list. Exactly what you need to make your event handler? | |
Oct 6, 2016 at 15:10 | comment | added | John John | then inside my itemadded method to check if the current web url contain /customersites/ , and if so to fire the modifications .. so in this case my event receiver will work on all the issue tracking lists under the /customersite/ url only .. is this sound valid ? | |
Oct 6, 2016 at 15:10 | comment | added | John John | ok i got your point.. but is there a more straight forward appraoch to associated an event receiver with a content type ? or to associate it to let say all the issue tracking lists inside a site collection.. then do extra filter on the itemadded method to run the actual code only on the specified sub sites ?? as i always try to keep things as simple as possible inside sharepoint ... so i am thinking on creating an event receiver inside my site collection,, and define it to run on all the issue tracking lists, | |
Oct 6, 2016 at 14:53 | comment | added | Juan Pablo Pussacq Laborde | Is not correct. You have to create a class for the event handler. Then in another class you use the code that I showed you to associate the event. The latter code is executed once in life to associate the event. It may be in a feature or elsewhere (an application page) | |
Oct 6, 2016 at 14:45 | comment | added | John John | ok fine so i will add the addEventContentType method inside the event receiver class , and the sample use will be inside the ItemAdded method ? is this correct ? second question now i assume that the url i will deploy this event receiver will be the site collection url (where the content type exsits) and not the url of the subsite ,, is this correct ? | |
Oct 6, 2016 at 14:25 | comment | added | Juan Pablo Pussacq Laborde | You have a class for the event reciever for instance "public class EventReceiverGovernance : SPItemEventReceiver" and you could put the code to make the association where you want. | |
Oct 6, 2016 at 14:22 | comment | added | John John | so this sample use will be inside the .cs class ? inside the event receiver ? could you provide as much details as you can so i can know how i need to create this ? | |
Oct 6, 2016 at 14:12 | comment | added | Juan Pablo Pussacq Laborde | Did you see "Sample use"? I added to my answer. | |
Oct 6, 2016 at 14:05 | comment | added | John John | i do agree with you regrading the site name.. so yes it is better to have the map inside a central list.. but still i am not sure what i need to specify when i create the event receiver inside visual studio?? , in regards to the sit url ,, event receiver type , etc... for example i followed the following steps when i created my event receiver c-sharpcorner.com/uploadfile/5b1f04/… | |
Oct 6, 2016 at 13:58 | comment | added | Juan Pablo Pussacq Laborde | I seem to make the group name is similar to the name of the site is prone to errors, because anyone could change the site name. I'm not saying it's wrong, just has some risk. With regard to creating the type of content from the UI no problem. I added an example in response. | |
Oct 6, 2016 at 13:58 | history | edited | Juan Pablo Pussacq Laborde | CC BY-SA 3.0 |
Added Sample use
|
Oct 6, 2016 at 13:46 | comment | added | John John | can you adivce further on this please? | |
Oct 6, 2016 at 13:02 | comment | added | John John | thanks for the reply. now when i create the event receiver using visual studio what will be the setting to associate it to the content type, baring in mind that i already have created the content type using the UI ? second point addign a list to store the relation is fine,, but why not to rely on the subsite name and the related group name to dynamically build the relation ? | |
Oct 6, 2016 at 12:58 | history | answered | Juan Pablo Pussacq Laborde | CC BY-SA 3.0 |