通过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<Appointment> appointments = calendar.FindAppointments(cView);

有这样的东西; D

点赞