internal void ExecuteDelayedMessages(Alert alert) { try { SPQuery query = new SPQuery(); query.Query = string.Format("<Where><Eq><FieldRef Name=\"{0}\" LookupId=\"TRUE\"/><Value Type=\"Lookup\">{1}</Value></Eq></Where>", "Alert", alert.Id); SPListItemCollection items = this.delayedAlertList.GetItems(query); if (items.Count > 0) { foreach (SPListItem item in items) { try { try { if (alert.SendAsSingleMessage) { DelayedAlert delayedAlert = new DelayedAlert(item); Notifications notificationSender = new Notifications(); SendDelayedMessage2(delayedAlert, alert, item); } else { DelayedAlert delayedAlert = new DelayedAlert(item); Notifications notificationSender = new Notifications(); notificationSender.SendDelayedMessage(delayedAlert, alert, item); } } catch { } continue; } finally { try { //Delete the delayed alert after completion } catch { } } } if (alert.SendAsSingleMessage) { SendMail(smtpSName, toAddress, fromAddress, ccAddress, subject, body, null); } } else { //No delayed alert found in the Delayed alert list } } catch { } }
internal void ExecuteDelayedMessages(Alert alert) { try { SPQuery query = new SPQuery(); query.Query = string.Format("<Where><Eq><FieldRef Name=\"{0}\" LookupId=\"TRUE\"/><Value Type=\"Lookup\">{1}</Value></Eq></Where>", "Alert", alert.Id); SPListItemCollection items = this.delayedAlertList.GetItems(query); if (items.Count > 0) { foreach (SPListItem item in items) { try { try { if (alert.SendAsSingleMessage) { DelayedAlert delayedAlert = new DelayedAlert(item); Notifications notificationSender = new Notifications(); SendDelayedMessage2(delayedAlert, alert,item); } else { DelayedAlert delayedAlert = new DelayedAlert(item); Notifications notificationSender = new Notifications(); notificationSender.SendDelayedMessage(delayedAlert, alert,item); } } catch { } continue; } finally { try { //Delete the delayed alert after completion } catch { } } } if (alert.SendAsSingleMessage) { SendMail(smtpSName, toAddress, fromAddress,ccAddress,subject,body,null); } } else { //No delayed alert found in the Delayed alert list } } catch { } }