Reputation: 533
this could be a simple question, but I am wrecking my brains. I am developing a solution to pick appointments for the next 10 days and send out SMS reminders.
But I'm stuck in that if an appointment is sent is processed today [26th], it will send out appointments for dates 27, 28, 29, 30, 31, 1, 2, 3, 4, 5. But the next day, which will be 27th, it will again send out appointments for dates28, 29, 30, 31, 1, 2, 3, 4, 5 adding 6
How do I avoid sending the repeats? Currently I am just getting the start and end date and filtering them to get the appointments. Your advice would be greatly be appreciated
string filter = "[Start] >= '"
+ startTime.ToString("g")
+ "' AND [End] <= '"
+ endTime.ToString("g") + "'";
Console.WriteLine(filter);
try
{
Outlook.Items calItems = folder.Items;
calItems.IncludeRecurrences = true;
calItems.Sort("[Start]", Type.Missing);
Outlook.Items restrictItems = calItems.Restrict(filter);
if (restrictItems.Count > 0)
{
return restrictItems;
}
else
{
return null;
}
}
catch { return null; }
Upvotes: 0
Views: 136
Reputation: 2010
You can store somewhere information about delivery time of notification for every appointment. This way you can avoid sending duplicates or implement smarter strategy like remind in 7 days, then in 3 days, and finally the day before event.
Upvotes: 1