我们的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地址没有与之关联的邮箱。"
如何读取没有关联邮箱的共享资源日历上的项目…或者这有可能吗?
谢谢! !
用邮件地址绑定日历
首先创建一个文件夹id: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
如果日历实际上不在任何特定的邮箱中,那么它应该在公共文件夹中,并且您应该在子文件夹WellKnownFolderName.PublicFoldersRoot
中查找。
否则,请告诉它在Outlook文件夹层次结构中的确切位置