0
嗨,
我需要在辦公室365得到特定的用戶可用性時間,但我在訪問日曆事件「SMTP地址沒有與之關聯的郵箱」時出現此錯誤,我在下面給出我的代碼,任何人都可以幫我解決這個錯誤。如何使用ews查找Office 365中的可用性日曆會議?
string stat = "06/18/2016 11:00:00 AM";
string end = "06/18/2016 2:00:00 PM";
DateTime start = Convert.ToDateTime(stat);
DateTime endt = Convert.ToDateTime(end);
string mailBox = "[email protected]";
ExchangeService esvc = new ExchangeService(ExchangeVersion.Exchange2010);
esvc.Credentials = new WebCredentials("[email protected]", "XXXXX", "XXXX.com");
esvc.Url = new Uri("https://XXXXXX.com/ews/Exchange.asmx");
FolderId shareFolderId = new FolderId(WellKnownFolderName.Calendar, "Calendar");
// The following line throws an exception.
CalendarFolder.Bind(esvc, shareFolderId);
FolderId parkplatzCalendarId = new FolderId(WellKnownFolderName.Calendar, mailBox);
CalendarFolder calendar = CalendarFolder.Bind(esvc, parkplatzCalendarId);
CalendarView cView = new CalendarView(start, endt, int.MaxValue);
cView.PropertySet = new PropertySet(AppointmentSchema.Subject, AppointmentSchema.Start, AppointmentSchema.End, AppointmentSchema.Duration, AppointmentSchema.LastModifiedName, AppointmentSchema.Organizer, AppointmentSchema.Categories);
FindItemsResults<Appointment> appointments = calendar.FindAppointments(cView);
只是爲了澄清一下,在哪一行代碼中你會得到這個異常? – SvenAelterman
也許你沒有提供用戶的*主SMTP地址*,而是一個別名? –
感謝重播Speedbrid,我得到這個錯誤第十行我的代碼「CalendarFolder.Bind(esvc,shareFolderId);」 – karthik