0
我正在尝试检索Outlook(带有Exchange2013)的用户日历的公共约会到稍后将显示的数据集。
下面是相关的代码至今:C#Outlook公开使用EWS的其他用户的约会
ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2013);
service.AutodiscoverUrl("[email protected]", RedirectionCallback);
DateTime reportDate = dateTimePicker1.Value;
DateTime startDate = new DateTime(reportDate.Year, reportDate.Month, reportDate.Day, 0, 0, 1);
DateTime endDate = startDate.AddHours(23);
endDate = endDate.AddMinutes(59);
CalendarFolder calendar = CalendarFolder.Bind(service, new FolderId(WellKnownFolderName.Calendar, "[email protected]"));
CalendarView cView = new CalendarView(startDate, endDate);
cView.PropertySet = new PropertySet(AppointmentSchema.Subject, AppointmentSchema.Start, AppointmentSchema.End, AppointmentSchema.Location);
// get appointment collection
FindItemsResults<Appointment> appointments = calendar.FindAppointments(cView);
// transfer to DataSet
DataSet1.Tables[0].Rows.Clear();
int i = 0;
foreach (Appointment a in appointments) {
DataSet1.Tables[0].Rows.Add(
i++.ToString(),
a.Subject.ToString(),
a.Start.ToString(),
a.End.ToString(),
a.Location.ToString());
}
例外被显示在线路
CalendarFolder日历= CalendarFolder.Bind(服务,新FolderId(WellKnownFolderName.Calendar,“somemail @ myCompany的.COM“));
任何想法我在这里做错了吗?或者,如何解决我的问题还有其他方法吗?
什么是例外? (为什么我甚至不得不要求你提供那个?) –
对不起,有史以来第一篇:)没有特别的例外,应该告诉你。它只是说有一个例外,类型“Microsoft.Exchange.WebServices.dll”,这是没有处理 – Derpcode
你说“没有特定的例外”,然后你继续说“Microsoft.Exchange.WebServices.dll”。这听起来很特别。什么是异常消息? –