【发布时间】:2018-07-15 14:42:19
【问题描述】:
我正在开发一个应用程序,我想从 Outlook 通讯簿的“所有房间”中检索可用房间。我能够从“所有房间”地址条目列表中检索所有房间条目。然后可以通过调用 AddressEntry.GetFreeBusy() 搜索单个房间的可用性。 但我面临的问题是代码的时间性能。如果房间数量很多(比如 500 个),那么搜索房间可用性所需的时间(最坏的情况是可用房间位于列表的最后一个附近)。
Microsoft.Office.Interop.Outlook.Application app = new Microsoft.Office.Interop.Outlook.Application()
var allRooms = app.Session.AddressLists["All Rooms"].Cast<Microsoft.Office.Interop.Outlook.AddressEntry>().ToLis();
DateTime today = DateTime.Today;
foreach(var room in allRooms)
{
//the below function will return the room status in a string of 1&0 for an interval of 1 min
string status = room.GetFreeBusy(today, 1, true); //sequentially calling this method is costly. What improvement can I do here?
//process the status and make some if free for certain time period add to list of available list
}
【问题讨论】:
标签: c# outlook office-interop outlook-addin