我们的Exchange管理员(Exchange 2010 SP1)已设置共享资源日历。 没有为此资源日历分配邮箱。我希望能够使用EWS和C#阅读会议。
段:
ExchangeService esvc = new ExchangeService(ExchangeVersion.Exchange2010);
esvc.Credentials = new WebCredentials(username, password, "ourplace.org");
esvc.Url = new Uri("https://OWA.OURPLACE.ORG/EWS/Exchange.asmx");
FolderId shareFolderId = new FolderId(WellKnownFolderName.Calendar, "Shared Calendar Name");
CalendarFolder.Bind(esvc, shareFolderId);
bind语句抛出错误:“SMTP地址没有与之关联的邮箱。”
如何阅读共享资源日历中没有关联邮箱的项目......或者甚至是可能的?
谢谢!
答案 0 :(得分:2)
使用mail-Adress
绑定到该日历首先创建一个FolderId:
FolderId parkplatzCalendarId = new FolderId(WellKnownFolderName.Calendar,"de.calendar.name@company.com");
然后绑定到这个:
CalendarFolder calendar = CalendarFolder.Bind(_service, parkplatzCalendarId);
现在你可以使用这个日历了!
CalendarView cView = new CalendarView(start, end, 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);
有类似的东西; D
答案 1 :(得分:0)
如果日历实际上不在任何特定邮箱中,那么它应该位于公共文件夹中,您应该查看子文件夹WellKnownFolderName.PublicFoldersRoot
。
否则,请告知它在Outlook文件夹层次结构中的确切位置。