My company is a bit concerned that there might be a performance difference between the following two ways of getting an appointment from Outlook:
private Microsoft.Office.Interop.Outlook.AppointmentItem FindeAppointment(DateTime startzeit, string subject)
{
string filter = string.Format("[Start] = '{0}' AND [Subject] = '{1}' AND [BillingInformation] = 'TEST'", startzeit.ToShortDateString() + " " + startzeit.ToShortTimeString(), subject);
MAPIFolder calendarFolder = outlookApplication.Session.GetDefaultFolder(Microsoft.Office.Interop.Outlook.OlDefaultFolders.olFolderCalendar);
Items items = calendarFolder.Items;
return items.Find(filter) as AppointmentItem;
}
private AppointmentItem FindeAppointment(DateTime startzeit, string subject)
{
MAPIFolder calendarFolder = m_outlookApplication.Session.GetDefaultFolder(OlDefaultFolders.olFolderCalendar);
IEnumerable<AppointmentItem> items = calendarFolder.Items.OfType<AppointmentItem>();
return items.FirstOrDefault(p => p.Start == startzeit &&
p.Subject == subject &&
p.BillingInformation == "TEST");
}
We want to do it the LINQ way, because we had some issues with the filter lately, so we needed a workaround.
I dont know any good way testing the performance of these method, I don't want to create thousands of appointments.
So, anybody has some figures or can tell me what's faster or atleast, how to test it?
Or should we just not care what to use, because its a very low speed different?