Fast retrieve daily appointment
-
Monday, January 11, 2010 5:06 PMHi,
I'm trying to retrieve daily appointment from my calendar. I'm using different solution but when I start my procedure it takes about 38 seconds to read all my appointment (more then 2600) and show daily information.
How can I retrieve daily appointments quickly?
This is my code snippet:
using (OutlookSession mySession = new OutlookSession())
{
// First solution
string query = "[Start] = " + DateTime.Now.ToShortDateString();
AppointmentCollection collection = mySession.Appointments.Items.Restrict(query);
if (collection.Count > 0)
{
return collection[0].Subject;
}
// Second solution
AppointmentCollection collection = mySession.Appointments.Items;
for (int i = 0; i < collection.Count; i++)
{
if (collection[i].Start == DateTime.Now)
return collection[i].Subject;
}
// Third solution
PropertyDescriptor pd = TypeDescriptor.GetProperties(typeof(Appointment))["Start"];
int dateIndex = mySession.Appointments.Items.Find(pd, DateTime.Now.ToShortDateString());
return collection[dateIndex].Subject;
}
Answers
-
Thursday, January 14, 2010 6:43 PM
Hi,
You may want to consider a "Divide and Conquer" mechanism for searching the AppointmentCollection.
I have produced a sample that demonstrates this :-
http://www.smartmobiledevice.co.uk/Projects/FasterAppSearchSample.zip
Please let me know asap if this does not meet your requirement. I have been able to record a significant improvement using this approach.
Hope this helps.
Paul Diston
http://www.smartmobiledevice.co.uk/ -
Monday, January 18, 2010 5:07 PM
Hi Paul,
Your suggestion works perfectly!!
It's very fast, I have 2637 appointments and this function requires about 0,5 sec to find the appointment of a specific date.
Thanks a lot for your help!
Ciuccigno- Marked As Answer by Ciuccigno68 Monday, January 18, 2010 5:08 PM
All Replies
-
Thursday, January 14, 2010 3:39 AMHi,
I think a possible solution is to use a timer to calculate which one has better performance.
Regards,
Zhe Zhao
-
Thursday, January 14, 2010 9:42 AMHi,
results are from 38 to 41 seconds. My problem is to find a different solution in order to retrieve daily appointments very quickly, 1-2 seconds max.
How can I "point" to a specific date in the pocketoutlook database? Or how can I manipulate fast the AppointmentCollection?
Thanks,
Ciuccigno -
Thursday, January 14, 2010 6:43 PM
Hi,
You may want to consider a "Divide and Conquer" mechanism for searching the AppointmentCollection.
I have produced a sample that demonstrates this :-
http://www.smartmobiledevice.co.uk/Projects/FasterAppSearchSample.zip
Please let me know asap if this does not meet your requirement. I have been able to record a significant improvement using this approach.
Hope this helps.
Paul Diston
http://www.smartmobiledevice.co.uk/ -
Monday, January 18, 2010 5:06 PMHi Paul,
Your suggestion works perfectly!!
It's very fast, I have 2637 appointments and this function requires about 0,5 sec to find the appointment of a specific date.
Thanks a lot for your help!
Ciuccigno -
Monday, January 18, 2010 5:07 PM
Hi Paul,
Your suggestion works perfectly!!
It's very fast, I have 2637 appointments and this function requires about 0,5 sec to find the appointment of a specific date.
Thanks a lot for your help!
Ciuccigno- Marked As Answer by Ciuccigno68 Monday, January 18, 2010 5:08 PM

