“摘要”的自定义电子邮件通知警报订阅类型
我正在为 WSS 3.0 解决方案开发自定义电子邮件通知。我使用继承自 IAlertNotifyHandler 的自定义类来生成电子邮件。有一个很好的例子 此处显示了如何针对即时警报执行此操作。以下是与 SPAlertHandlerParams 相关的一些代码,用于获取有关警报和触发警报的项目的信息。
SPAlertHandlerParams ahp;
int id = ahp.eventData[0].itemId; //gets the itemId of the item triggering the notification.
SPListItem myItem = list.GetItembyId(id);
对于即时警报,这非常有用,因为我想要的项目始终位于 eventData 对象的 [0] 位置。对于摘要事件,我认为我可以循环遍历 ahp.eventData 中的所有项目。这有两个问题。
首先,它向我提供了发送通知的所有事件,而不仅仅是我的事件。其次,eventData[0].itemId 不再指向列表上的有效 ID。它是 6-7 位数字,而不是 3 位数字。
有谁知道获取摘要电子邮件警报信息的正确方法? 如果您对此还有任何其他问题,请告诉我。
感谢您的帮助!
I am working on a custom email notification for a WSS 3.0 solution. I am using a custom class inheriting from IAlertNotifyHandler to generate the email. There is a great example here that shows how this is done for an Immediate alert. Here is some of the code related to the SPAlertHandlerParams, which is used to get information about the alert and the item that triggered the alert.
SPAlertHandlerParams ahp;
int id = ahp.eventData[0].itemId; //gets the itemId of the item triggering the notification.
SPListItem myItem = list.GetItembyId(id);
For immediate alerts, this works great as the item I want is always at the [0] position of the eventData object. For a digest event, I thought I could just loop through all of the items in the ahp.eventData. Two problems with this.
First, it gives me all of the events where it is sending notifications, not just the ones for me. Second the eventData[0].itemId no longer points to a valid id on the list. It is 6-7 digit number instead of a 3 digit number.
Does anyone know the correct way to get to the alert information for digest emails?
Please let me know if you have any additional questions about this.
Thanks for your help!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
对于我的项目,我创建了一个自定义计时器作业(使用 Andrew Connell 的 帖子 )模仿警报功能。它会整夜运行,并查询订阅我的列表的所有用户,并提供每日警报。然后,它将所有新任务打包到自定义电子邮件中。
我保留了自定义警报,以抑制系统发出的任何每日通知。我只是返回“True”,这样就不会为仅分配给 1 个人的任务发送警报。我想回顾这一点,我可以在自定义警报中运行查询代码,而不需要单独的计时器作业。
For my project, I created a custom timer job (using the post by Andrew Connell) that mimics the Alert functionality. It runs overnight and queries for any users subscribed to my list with daily alerts. It then packages all of the new tasks into a custom email message.
I left the custom alert in place to suppress any daily notifications from the system. I just return 'True' so that alerts are not sent for tasks assigned to only 1 person. I suppose looking back on this, I could have run the query code in the custom alert and not need a separate timer job.