2
我試圖構建.NET應用程序,目的是從交換帳戶檢索日曆信息。我想檢索關於資源的忙/閒信息。 我使用EWS .NET API與Exchange 2010連接。Exchange EWS API .NET - CalendarEvents.Details始終爲空
我可以檢索諸如約會的開始時間和結束時間之類的信息,但我無法獲取其他信息,如主題,包含在CalendarEvents.Details中的位置。事實上,這最後一個屬性始終爲空。 顯然它可能是一個權限問題,但它不合邏輯,因爲我試圖用我自己的憑據來閱讀我自己的日曆。
//Exchange Connection
this.service = new ExchangeService(ExchangeVersion.Exchange2010);
service.Credentials = new WebCredentials(user, password, domain);
service.AutodiscoverUrl(this.email);
List<AttendeeInfo> attendees = new List<AttendeeInfo>();
//L'utilisateur déclaré dans l'objet, identifié par l'email
attendees.Add(new AttendeeInfo()
{
SmtpAddress = this.email,
AttendeeType = MeetingAttendeeType.Organizer
});
AvailabilityOptions myOptions = new AvailabilityOptions();
myOptions.MeetingDuration = 30;
myOptions.RequestedFreeBusyView = FreeBusyViewType.FreeBusy;
GetUserAvailabilityResults freeBusyResults = service.GetUserAvailability(attendees,
new TimeWindow(DateTime.Now, DateTime.Now.AddDays(1)),
AvailabilityData.FreeBusy,
myOptions);
foreach (AttendeeAvailability availability in freeBusyResults.AttendeesAvailability)
{
foreach (CalendarEvent calendarItem in availability.CalendarEvents)
{
//The details here are always null :/
if (calendarItem.Details != null)
{
label3.Text = "Subject: " + calendarItem.Details.Subject +"\n";
label3.Text += " Location:" + calendarItem.Details.Location ;
}
label3.Text += "\n";
label3.Text += "Start:" + calendarItem.StartTime.TimeOfDay ;
label3.Text += "End:" + calendarItem.EndTime.TimeOfDay;
label3.Text += "\n";
panel1.BackColor = Color.PaleVioletRed;
break;
}
}
謝謝你在前進,
您是否有解決方案?我也遇到了同樣的問題。此外,我可以找到一種方法來設置其他api中可用的Shape,我可以告訴webservice獲取所有屬性。 – lalit
剛剛找到它。服務器需要進行配置以顯示詳細信息。看到這個http://exchangeserverpro.com/show-full-freebusy-exchange-2010-room-resource-mailboxes/ – lalit