To check is the List Item has been checkout or checkin the below code snippet will help.
If vti_sourcecontrolcheckedoutby of AfterProperties is null and vti_sourcecontrolcheckedoutby of BeforeProperties is NOT null then the event is caused by Checkin.
if (properties.AfterProperties["vti_sourcecontrolcheckedoutby"] == null
&& properties.BeforeProperties["vti_sourcecontrolcheckedoutby"] != null)
{
// event is fired by check-in.
}
else
{
// events fired other than check-in .
}
Note : Better to use EventFiringEnabled=false at the starting point of the function in the event receiver (Item updating,Item Adding etc....)
and at last, make to true.
EventFiringEnabled=true. Which avoids unnecessary event firing of List items
Sharepoint smoking..........
Dharani CM
Comments
Post a Comment