WSS Alert(邮件提醒) 定制
項目需要,研究了一下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,其實,用代碼也是可以的:
//取到服務器的模板即可
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
總結
以上是生活随笔為你收集整理的WSS Alert(邮件提醒) 定制的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 苹果承认万元显示器Studio Disp
- 下一篇: Lession 14 Do you sp