Steps Involved:
1. Create an event reciever
2. Create a feature to call the reiever when activated.
3. Create a feature stapler to staple the feature to Site Defs.
        public override void FeatureActivated(SPFeatureReceiverProperties properties)
        {
            SPWeb CurrentWeb = properties.Feature.Parent as SPWeb;
            String Body = "A Sub Site Created with Title \""+ CurrentWeb.Title+ "\" with the URL  "+CurrentWeb.Url;
            foreach (SPUser user in  CurrentWeb.Groups["AllAlerts"].Users)
            {
                SPUtility.SendEmail(CurrentWeb, false, false, user.Email, "Site Creation Alert", Body);                
            }
        }
//Use the sharepoint inbuilt capability of sendin and email fron the SPUtility
No comments:
Post a Comment