What’s New in SharePoint 2010 – 1 (SPAlert)

Now i am starting a new series which focused on the new features available in upcoming SharePoint 2010.

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 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.

Shantha Kumar
Shantha Kumar
Articles: 280

24,849 Comments

  1. Very interesting, understand that there is an option in Central Administration to set “outgoing sms” similar with “outgoing e-mail” ?

  2. Nice.
    Question. Is there a way to create new delivery methods?. Say I want it to write the alert on a specific named List of the users MySite? Something like activities list, but for alerts?

Comments are closed.