SPAlertPipeline: How to get user alert is being sent to?

Nov 30, 2007 at 9:28 PM
There doesn't seem to be any way to get the actual user that the alert is going to from the SPAlertHandlerParams object. I need to get to the user's profile to obtain information like the cell phone number in order to send an alert as an SMS message.

Am I missing something? Any help is appreciated.
Nov 30, 2007 at 10:15 PM
Edited Nov 30, 2007 at 10:16 PM

michael_dev wrote:
There doesn't seem to be any way to get the actual user that the alert is going to from the SPAlertHandlerParams object. I need to get to the user's profile to obtain information like the cell phone number in order to send an alert as an SMS message.

Am I missing something? Any help is appreciated.


Steve Peschka answered this for me on the Sharepoint team blog. For anyone that might be interested there is a field called "a" on the SPAlertHandlerParams struct that points to the SPAlert object, which has a "User" member that points to the SPUser the alert is being sent to.
May 29, 2008 at 3:02 PM

I found that

SPSite site = new SPSite(ahp.siteUrl + ahp.webUrl);
SPWeb web = site.OpenWeb();
SPUser u = web.AllUsers.GetByID(ahp.a.UserId);

works.

If I try to access ahp.a.User then I get a null reference exception

Casey
               

michael_dev wrote:


michael_dev wrote:
There doesn't seem to be any way to get the actual user that the alert is going to from the SPAlertHandlerParams object. I need to get to the user's profile to obtain information like the cell phone number in order to send an alert as an SMS message.

Am I missing something? Any help is appreciated.


Steve Peschka answered this for me on the Sharepoint team blog. For anyone that might be interested there is a field called "a" on the SPAlertHandlerParams struct that points to the SPAlert object, which has a "User" member that points to the SPUser the alert is being sent to.