1.管理中心==》应用程序管理==》Web 应用程序常规设置==》向后兼容的事件处理程序==》启用
2.代码
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.SharePoint;
using System.IO;
namespace test
{
public class test_eh:IListEventSink
{
public void OnEvent(SPListEvent spe)
{
if (spe.Type == SPListEventType.Delete)
{
string path = @"c:\eh_test.txt";
string strText = "My EventHandler Test:" + DateTime.Now.ToString();
StreamWriter sw = new StreamWriter(path);
sw.Write(strText);
sw.Close();
}
}
}
using System.Collections.Generic;
using System.Text;
using Microsoft.SharePoint;
using System.IO;
namespace test
{
public class test_eh:IListEventSink
{
public void OnEvent(SPListEvent spe)
{
if (spe.Type == SPListEventType.Delete)
{
string path = @"c:\eh_test.txt";
string strText = "My EventHandler Test:" + DateTime.Now.ToString();
StreamWriter sw = new StreamWriter(path);
sw.Write(strText);
sw.Close();
}
}
}
}
生成DLL,copy入moss目录下的bin文件夹
3. 文档中心 > 文档1 > 设置 > 高级设置==》向后兼容的事件处理程序
程序集名称:test, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
类名称:namespace.classname
此类功能是在列表删除文档的时候保存一条日志,很简单的例子,开启了一条MOSS管理与开发的新道路。
浙公网安备 33010602011771号