Let’s change the Item Adding Event (as it is already defined in our CAML to be deployed).
We will change the itemadding event so that it will check, when an item is being added, by making sure the Check Value column does not contain the string “dontadd”.
Another important part of the feature is the What is important for us? The List Template Id defines to which List Types the Event Handler will be targeting.
As shown in the image below, firstly we’re going to add an event receiver, select the list to which the event handler needs to work , check the item added and item being updated (as we need to validate during edits as well). Now we will write our validation code in the event receiver. In this code we will check if the acronym exists in the other list, if yes, we will cancel the addition. Even this function will take care of the updating scenario duplicate validation.
Next we’ll write the updating part of the code, as shown below.
Item Adding means that the event will be fired right before the item is added to the list.
This allows us to modify the item before it is saved to the list.
And this acronym data will be used in many places to accomplish many business requirements.
In most cases, we can easily utilize the OOB concept to validate the uniqueness of the columns.
Demo Event : the code that will be overriding the existing Share Point Event Handlers.
Let’s take a look at our code: What this file does is identify the feature for Share Point (Id), give it a title and description (which will be shown on the feature activation site), define a scope (where Web means site, where Site means Site Collection and then there is Web Application and Farm as possible scopes.
In the updating scenario we will pass the unique ID of the item rather than new GUID which we passed in the above adding scenario.
public override void Item Updating(SPItem Event Properties properties) That’s it!
It’s a piece of code that is triggered when something (an event! When that happens, our event handler can replace what is supposed to happen with our own code.Tags: Adult Dating, affair dating, sex dating