我正试图通过Exchange EWS获取Exchange中一个房间的所有约会。
ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2010_SP2);
service.UseDefaultCredentials = true;
service.AutodiscoverUrl("hans.muster@domain.com", RedirectionUrlValidationCallback);
// Return all the room lists in the organization.
EmailAddressCollection roomLists = service.GetRoomLists();
System.Collections.ObjectModel.Collection<EmailAddress> rooms = service.GetRooms("ZimmerZuerich@domain.com");
EmailAddress roomAdress = rooms[31];
FolderId folderid = new FolderId(WellKnownFolderName.Calendar, new Mailbox(roomAdress.Address));
FindItemsResults<Appointment> aps = service.FindAppointments(folderid, new CalendarView(DateTime.Now, DateTime.Now.AddHours(24)));
如果我运行此代码,我会收到一条错误消息:
{"The specified folder could not be found in the store."}.
事实上,如果我向我展示这样一个房间邮箱的所有文件夹的集合,那么其中没有文件夹。
我做错了什么?互联网上的所有示例都使用WellKnownFolderName.Calendar。
答案 0 :(得分:2)
该错误通常表示您的凭据可以连接到Exchange但您无权访问您尝试访问的日历,因此您需要使用Add-MailboxPermission授予对邮箱的访问权限,或者使用Add-MailboxFolderPermissions
授予对日历文件夹的访问权限干杯 格伦