2015-05-28 25 views
0

this questionOffice 365的DLL查詢Calendarview不支持的startDateTime或EndDateTime

當查詢CalendarView類似,它似乎並不支持開始和結束(所以他們沒有得到轉化爲正確的值)。

我的代碼返回一個錯誤,因爲我沒有包含參數。

有沒有辦法通過OutlookServicesClient添加這些參數呢?

我當前的代碼如下所示:

  Dim calendarView = exClient.Me.CalendarView 
      ' For Each Attendee In AttendeesFilter.Split(New Char() {Char.Parse(";")}, StringSplitOptions.RemoveEmptyEntries) 
      ' calendarView.Where(Function(dl) dl.Attendees.Any(Function(el) el.EmailAddress.Equals(Attendee))) 
      ' Next 'Office365 doesnt seem to filter on attendees 

      startDate = DateTime.Now.AddMonths(-1) 
      endDateTime = DateTime.Now 

      If startDate.HasValue AndAlso endDateTime.HasValue Then 
       calendarView.Where(Function(dl) dl.Start.Value <= startDate.Value AndAlso dl.End.Value <= endDateTime.Value) 'doesnt seem to filter on dates 
      End If 

我收到確切的錯誤是:

Type: Microsoft.OData.Core.ODataErrorException 

Message: This request requires a time window specified by the query string parameters startDateTime and endDateTime. 

雖然我似乎無法找到如何添加時間窗口之有道:■

回答

0

還有一個功能:

exClient.Me.Calendar.GetCalendarView(startDateOffset, endDateOffset) 
的個

開始和結束日期之間的這種過濾器,而不是將其添加到查詢

0

你可以得到一個CalendarView如下:

var eventResults = await exClient.Me.Calendar 
        .GetCalendarView(startDateTime,endDateTime) 
        .Take(10) 
        .ExecuteAsync();