开发者

Custom email notifications for "Digest" type of alert subscription

开发者 https://www.devze.com 2023-02-15 05:03 出处:网络
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 he开发者_JS百科re that

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 he开发者_JS百科re 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!


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消