通过EWS和C#访问没有邮箱的资源日历

我们的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地址没有与之关联的邮箱。”

如何阅读共享资源日历中没有关联邮箱的项目……或者甚至可能?

谢谢 !!

使用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 appointments = calendar.FindAppointments(cView); 

有这样的东西; D

如果日历实际上不在任何特定邮箱中,那么它应该在公共文件夹中,您应该查看子文件夹WellKnownFolderName.PublicFoldersRoot

否则,请告诉它在Outlook文件夹层次结构中的确切位置。