我在SharePoint 2013基础上进行开发.对于某些SharePoint列表,将立即为特殊用户创建警报.以编程方式创建警报. 用户注意到列表项字段通过电子邮件发生了变化.因此可能会问,当列表字段更改的时间不同时,用户仅收到一封更改的电子邮件,为什么?有关更多信息,该字段更改后立即运行警报计时器作业.如何配置 以编程方式(C#)发出警报,以便发出警报以应对两个更改或存在另一种方法?
I develop on SharePoint 2013 foundation. For some SharePoint list there is immediately created alert for special user. Alert created programmatically. User noticed about list items fields changing through email. So may question when list fields changed different times user receive email only for one change, why? For more information Immediately Alert timer job run after that fields changing. How to configure alert programmatically (C#) in order alert to work for two changes or there is another way?
推荐答案
古尔根,
请在下面创建类似代码段的警报:
Please create the alert like code snippet below:
static void Main(string[] args) { using (SPSite site = new SPSite("sp/sites/dev")) { using (SPWeb objWeb = site.OpenWeb()) { objWeb.AllowUnsafeUpdates = true; SPList list = objWeb.Lists["RestDate"]; SPUser currentuser = objWeb.CurrentUser; SPAlert newAlert = currentuser.Alerts.Add(); newAlert.Title = list.Title; newAlert.AlertType = SPAlertType.List; newAlert.List = list; newAlert.DeliveryChannels = SPAlertDeliveryChannels.Email; newAlert.EventType = SPEventType.Modify; newAlert.AlertFrequency = SPAlertFrequency.Immediate; newAlert.Update(); objWeb.Update(); } } }它将发送多个更改的警报,如下所示:电子邮件警报:
And it will send alert for multiple changes, see the email alert like below:
已更改标题警报:
更改了日期字段警报:
谢谢
最好的问候
更多推荐
SharePoint警报无法正常工作
发布评论