招投标网站建设开发,知名设计网站公司,深圳网站建设公司,产品单页营销型网站模板项目需要#xff0c;研究了一下WSS的Alert定制。 定制有两种方法: (方法1)修改模板文件 默认模板是12\TEMPLATE\XML\alerttemplates.xml,将这个模板复制一份修改,然后用stsadm命令添加模板: STSADM -o updatealerttemplates -url http://urlname -filename your w…项目需要研究了一下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,其实,用代码也是可以的: string templateNamecustomTemplate1;//取到服务器的模板即可SPAlertTemplateCollection ats new SPAlertTemplateCollection((SPWebService)( base.GetCurrentSPSite().WebApplication.Parent)); //添加或修改模板 SPAlertTemplate t ats[templateName]; if( t null ) t ats.Add(); t.Name templateName; t.Xml xmlDoc.InnerXml; t.Update();//可以单独设置列表的模板:SPList list someList ;list.AlertTemplate ats[templateName];//列表试用的模板必须存在与服务器的模板集合中,直接呢为一个模板对象是不可以的.list.ParentWeb.AllowUnsafeUpdates true;list.Update(); 转载于:https://www.cnblogs.com/jianyi0115/archive/2008/04/09/1145751.html