In previous versions; by out of the box, alerts are send only through e-mails, but in SP2010 we can able to send an alerts to mobile devices as SMS Message. For that, we have a new property under SPAlert, that indicates whether the alert is delivered as E-mail or as an SMS Message.

 

By default alerts can be send only through e-mail. But we can change that default setting by coding option using the new DeliveryChannels Property of SPAlert class. This DeliveryChannels property, specifies the delivery method of the alert.

 

The following snippet used to set the SMS delivery method to the Alert.

oAlert.DeliveryChannels = SPAlertDeliveryChannels.Sms;

 

SPAlertDeliveryChannels is the enumerated member, which specifies the method of delivering alerts.

 

 

Member Name

Description

Email

Delivery as E-mail

Sms

Delivery as SMS Message

The following example code used to update the sms delivery method to all the alerts for every user available in Current website.

SPWeb oWebsite = SPContext.Current.Web;
SPUserCollection collUsers = oWebsite.Users;

foreach (SPUser oUser in collUsers)
{
SPAlertCollection collAlerts = oUser.Alerts;

foreach (SPAlert oAlert in collAlerts)
{
oAlert.DeliveryChannels = SPAlertDeliveryChannels.Sms;
oAlert.Update();
}
}

 

That’s all for now!! By soon I’ll be back with the post on new feature in SharePoint 2010.