Question

I have a huge list of resource mailboxes that I am getting all of the calendar items from. Currently to get them from the FindItemResults<Appointment> to the List<Appointment> I am doing the following:

    FindItemsResults<Appointment> tApts = service.FindAppointments(CalendarFolderID, cv);
    Collection<Appointment> tApts2 = tApts.Items;
    List<Appointment> apts = tApts2.Cast<Appointment>().ToList();

Is this the best way to do it? It seems quite redundant to go from FindITemResults -> Collection -> List.

Is there a way to bypass that Collection<Appointment> conversion?

Was it helpful?

Solution

You should be able to do something like this:

FindItemsResults<Appointment> tApts = service.FindAppointments(CalendarFolderID, cv);
List<Appointment> apts = tApts.Items.ToList<Appointment>();

The Items property is a Collection<T> which you can do a .ToList() with the extension methods as long as you have using System.Linq; defined in your cs file.

Hope this helps.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top