0
kicks
SPItemEventReciever class ?
SPItemEventReciever; ( msdn is a reference )
its a magical class :D , that i have read about it and i wanted to share it with you , this class will be very useful to all sharepoint users and developers who integrates both asp and sharepoint together , this class is a very useful class ...
i dont know about it so much but it will be my study and my subject in the next blogs ...
first of all ;
what is SPItemEventReciever?
its a class that cant be instantiated , which means that we cant create an object from it , but this class is used as a parent class to the class that handles or overrides the events done to any list item in my sharepoint site...
when SPItemEventReciever can be used ?
it can be used when you want to override any event that done to a list item in a sharepoint list such as :
1. ItemAdded.
2. ItemAdding.
3. ItemDeleted.
4. ItemDeletion.
and many other events like adding attachments to lists and , moving list items , also this events can replace some workflows that are simple , like workflows that add the item to more than one list , as we can add an item to a list , and by overriding the event of ItemAdding we can add the same item in other lists , or we can override the ItemDeleting function and delete an item from more than one list ....
i will write you some code in the next post but this one is a simple introduction to SPItemEventReciever...
there is some FAQs , that came in my mind when i was reading about SPItemEventReciever...
the most important question was , i want to know about the parameters will be sent to me in the functions will be overrided like ItemDeleting or ItemAdding and i found :
that the function override is written as follows :
public override void ItemDeleting(SPItemEventProperties properties)
{
}
so the object properties instantiated from , what does this object contains and what are the info inside it i can use... ?
we can find in this class or the object from it all what we need so we can write our functions simply we can find :
ListId = which is the id of the list that throws the event...
ListItemId = which is the id of the item the event is done to it...
ListTitle = gets the Title of the list you re working on...
WebUrl = gets the web url you re working in ...
SiteId = Gets the ID of the site in which the event occurred...
these are the most important properties that you can need ...
this post was an introduction to SPItemEventReciever class which we wil