private void CreateDelayedAlert(Alert alert, AlertEventType eventType, SPItemEventProperties properties, AlertManager alertManager) { //, SPWeb web try { if (!alert.SendAsSingleMessage) { Notifications notificationSender = new Notifications(); //Need to get the Alert instances MailTemplateUsageObject mtObject = alert.GetMailTemplateUsageObjectForEventType(eventType); //string subject = mtObject.Template.Subject; //string body = mtObject.Template.Body + "<br>" + "<br>" + FinalBody; string subject = notificationSender.ReplacePlaceHolders(mtObject.Template.Subject, properties.ListItem); string body = notificationSender.ReplacePlaceHolders(mtObject.Template.Body, properties.ListItem) + "<br>" + "<br>" + FinalBody; string parentItemId = Convert.ToString(properties.ListItem.ID); DelayedAlert dAlert = new DelayedAlert(subject, body, alert.Id, parentItemId, eventType); alertManager.AddDelayedAlert(dAlert); } else { Notifications notificationSender = new Notifications(); MailTemplateUsageObject mtObject = alert.GetMailTemplateUsageObjectForEventType(eventType); string subject = properties.ListTitle; string body = notificationSender.ReplacePlaceHolders(mtObject.Template.Subject, properties.ListItem) + "<br>" + "<br>" + notificationSender.ReplacePlaceHolders(mtObject.Template.Body, properties.ListItem) + "<br>" + "<br>" + FinalBody; string parentItemId = Convert.ToString(properties.ListItem.ID); DelayedAlert dAlert = new DelayedAlert(subject, body, alert.Id, parentItemId, eventType); alertManager.AddDelayedAlert(dAlert); } } catch { } }
private void CreateDelayedAlert(Alert alert, AlertEventType eventType, SPItemEventProperties properties, AlertManager alertManager) { //, SPWeb web try { if (!alert.SendAsSingleMessage) { Notifications notificationSender = new Notifications(); //Need to get the Alert instances MailTemplateUsageObject mtObject = alert.GetMailTemplateUsageObjectForEventType(eventType); //string subject = mtObject.Template.Subject; //string body = mtObject.Template.Body + "<br>" + "<br>" + FinalBody; string subject = notificationSender.ReplacePlaceHolders(mtObject.Template.Subject, properties.ListItem); string body = notificationSender.ReplacePlaceHolders(mtObject.Template.Body, properties.ListItem) + "<br>" + "<br>" + FinalBody; string parentItemId = Convert.ToString(properties.ListItem.ID); DelayedAlert dAlert = new DelayedAlert(subject, body, alert.Id, parentItemId, eventType); alertManager.AddDelayedAlert(dAlert); } else { Notifications notificationSender = new Notifications(); MailTemplateUsageObject mtObject = alert.GetMailTemplateUsageObjectForEventType(eventType); string subject = properties.ListTitle; string body = notificationSender.ReplacePlaceHolders(mtObject.Template.Subject, properties.ListItem) + "<br>" + "<br>" +notificationSender.ReplacePlaceHolders(mtObject.Template.Body,properties.ListItem) + "<br>" + "<br>" + FinalBody; string parentItemId = Convert.ToString(properties.ListItem.ID); DelayedAlert dAlert = new DelayedAlert(subject, body, alert.Id, parentItemId, eventType); alertManager.AddDelayedAlert(dAlert); } } catch { } }