项目需要,研究了一下WSS的Alert定制。
定制有两种方法:
(方法1)修改模板文件
默认模板是12\TEMPLATE\XML\alerttemplates.xml,将这个模板复制一份修改,然后用stsadm命令添加模板:
STSADM -o updatealerttemplates -url <http://urlname> -filename <your working copy filename>.
(方法2)写一个类,实现IAlertNotifyHandler接口,然后将这个类的实现配置到自定义的Alert模板中.同样需要用stsadm添加模板.
第一种方法好处是不需要处理具体的发邮件逻辑,但是,因为模板的声明是采用类似CAML的语法,修改起来很是麻烦,并且不能做一些复制的逻辑判断.
第二中方法需要代码来处理发邮件逻辑,控制灵活,但是可能会失去一些系统模板的功能(如项目修改事件通知可以显示出那些字符修改了,那些字符是新添加的).
具体请参考这两篇文章:
http://support.microsoft.com/kb/948321
这篇是wss sdk团队的人写的:
http://blogs.msdn.com/sharepointdeveloperdocs/archive/2007/12/07/customizing-alert-notifications-and-alert-templates-in-windows-sharepoint-services-3-0.aspx
以上两篇文章都采用stsadm添加Alert template,其实,用代码也是可以的:






















