我試圖使用Exchange 2007 API來查詢特定用戶的日曆可用性。我的示例代碼是生產以下情況除外:我創建的DateTime對象和DateTime.Now之間的區別
爲FreeBusyViewOptions.TimeWindow指定的持續時間是 無效。
這裏的示例代碼:
ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2007_SP1);
service.AutodiscoverUrl("[email protected]");
DateTime startTime = new DateTime(2012, 1, 6, 7, 0, 0);
TimeWindow tw = new TimeWindow(startTime, startTime.AddHours(8));
GetUserAvailabilityResults result = service.GetUserAvailability(new List<AttendeeInfo> { new AttendeeInfo("[email protected]") }, tw, AvailabilityData.FreeBusyAndSuggestions);
的奇怪的事情是,如果我與它的工作原理如下取代我的開始時間分配:
DateTime startTime = DateTime.Now;
什麼是DateTime對象之間的區別我創建並由DateTime.Now生成的對象。我在調試過程中詳細檢查過它們,並且找不到區別。
任何想法?
日期時間現在爲您提供當前日期時間,並且您提供的日期時間是2012年1月6日7:00:00 – 2012-01-05 22:46:52
我意識到實際日期/時間不同,但即使我將對象的日期/時間設置爲等於現在它有同樣的問題。 – joshb 2012-01-05 22:53:23