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

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

本文介绍了通过EWS和C#访问没有邮箱的资源日历的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们的Exchange管理员(Exchange 2010 SP1)已设置共享资源日历。 没有分配给该资源日历的邮箱。我希望能够使用EWS和C#阅读会议。

Our Exchange Admins (Exchange 2010 SP1) have setup a shared resource calendar. There is no mailbox assigned to this resource calendar. I want to be able to read the meetings using EWS and 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地址没有与之关联的邮箱。

the bind statement throws the error: "The SMTP address has no mailbox associated with it."

我如何读取没有关联邮箱的共享资源日历中的项目……还是有可能?

How can I read the items on a Share Resource Calendar that has no associated mailbox... or is it even possible?

谢谢!!

推荐答案

使用邮件地址绑定到该日历

Bind to that Calendar with a mail-Adress

首先创建一个FolderId:

Create first of all a FolderId:

FolderId parkplatzCalendarId = new FolderId(WellKnownFolderName.Calendar,"[email protected]");

然后绑定到这个:

CalendarFolder calendar = CalendarFolder.Bind(_service, parkplatzCalendarId);

现在您可以使用此日历了!

Now you can use this calendar!

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

这篇关于通过EWS和C#访问没有邮箱的资源日历的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-23 02:16