As it turns out, there is a bug in the method which causes it not to expand appointments if your start and end date are the same. Thanks M$.
Recurring appointments aren't expanding recurrence using CalendarFolder.FindAppointments in the C# Exchange Web Service API
-
01-06-2022 - |
Frage
According to the docs, .FindAppointments() expands the recurrence of items:
Obtains a list of appointments by searching the contents of this folder and performing recurrence expansion for recurring appointments
It's not working:
ExchangeService service = ExchangeServiceUtilities.CreateExchangeService(s,u);
DateTime now = DateTime.Now;
CalendarView cv = new CalendarView(now, now);
CalendarFolder cal = CalendarFolder.Bind(service,WellKnownFolderName.Calendar);
FindItemsResults<Appointment> apps = cal.FindAppointments(cv);
Trace.WriteLine(apps.TotalCount);
foreach (Appointment a in apps)
{
a.Load();
Trace.WriteLine(a.IsRecurring);
Trace.WriteLine("Checking: " + a.End.ToString() + " : " + now);
if (a.End > now)
{
Trace.WriteLine("Setting Appointment for: " + u.Id);
ScheduleAppointment(a,u);
}
}
produces the following:
1
True
Checking: 6/24/2013 10:00:00 PM : 6/24/2013 9:41:12 PM
Setting Appointment for: 6dd36837d202bf28b0a8cfece47fb111cd0fec04
It's set to recur every half hour, so I should be seeing a lot more of them...
I figured out what was wrong: As it turns out, there is a bug in the method which causes it not to expand appointments if your start and end date are the same. Thanks M$.
Lösung
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow