Sharepoint中EventHander的例子
public class ListEvenClass : SPListEventReceiver
{
public override void FieldAdded(SPListEventProperties properties)
{
LogEvent(properties, "添加");
}
public override void FieldDeleted(SPListEventProperties properties)
{
LogEvent(properties, "删除");
}
private void LogEvent(SPListEventProperties properties, string eventName)
{
StreamWriter sw = File.AppendText(@"C:\listeventlog.txt");
StringBuilder sb = new StringBuilder();
sb.AppendFormat("[{0}] {1} Event Occurred:\n", DateTime.Now.ToString(), eventName);
sb.AppendFormat("\tList : {0}", properties.ListTitle);
sb.AppendFormat("\t{0} - Field {1}", properties.EventType.ToString(), properties.FieldName);
sw.WriteLine(sb.ToString());
sw.Close();
}
}
目前维护的开源产品:https://gitee.com/475660