Item Updating or Updated Event Occurs twice in Document Library

Item Updating or Item Updated Event in SharePoint 2007 occurs twice, if require checkout option is enabled for document library.

I found the following workaround from Microsoft Support for this issue.

Check the value of vti_sourcecontrolcheckedoutby
in BeforeProperties and AfterProperties, if the both values are null then the event is triggered by check in else the event is triggered by other actions.

if (properties.AfterProperties[“vti_sourcecontrolcheckedoutby”] == null && properties.BeforeProperties[“vti_sourcecontrolcheckedoutby”] != null)

{

//This is when the update event is triggered by check-in.

}

else

{

//This is triggered by events other than check-in action.

}

Comments are closed.