我们通过交换管理我们的汽车游泳池的预订。每辆汽车都有一台压光机,您可以在该压光机上插入与汽车的约会,因为您想要使用它。如何从EWS检索公共日历?
我的任务是检索每辆汽车的日历和每个约会,但我坚持如何通过EWS进行正确的呼叫。
我的步骤如下:
- 创建Exchange服务的服务帐户的
- 使用凭证
AutodiscoverUrl()
- 创建CalenderFolder,CalenderView UND检索约会。
- ?
现在我的问题位于“检索约会”,因为我只能用WellKnownFolders访问我自己的日历。
我怎样才能访问其他公共calanders并检索他们的约会?
这是我与迄今使用的代码:(从http://msdn.microsoft.com/en-us/library/office/dn439786(v=exchg.80).aspx聚集)
ServicePointManager.ServerCertificateValidationCallback = CertificateValidationCallBack;
ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2010_SP1);
service.Credentials = new WebCredentials(@"domain\svc_account", @"Dummypassword");
service.UseDefaultCredentials = false;
service.TraceEnabled = true;
service.TraceFlags = TraceFlags.All;
service.AutodiscoverUrl(@"[email protected]", RedirectionUrlValidationCallback);
DateTime startTime = DateTime.Now;
DateTime endTime = DateTime.Now.AddDays(10);
int num_appts = 10;
CalendarFolder calFolder = CalendarFolder.Bind(service, WellKnownFolderName.Calendar, new PropertySet());
CalendarView calView = new CalendarView(startTime, endTime, 10);
calView.PropertySet = new PropertySet(AppointmentSchema.Subject, AppointmentSchema.Start, AppointmentSchema.End);
FindItemsResults<Appointment> appointments = calFolder.FindAppointments(calView);
foreach (Appointment a in appointments)
{
//Do stuff later on...
}
还是那句话:这非常适用于在我的压延约会。我无法在MSDN中找到有关如何访问其他人数据的部分。
我确认你的答案,但我需要等到管理员为服务帐户提供适当的权限才能以用户身份进行模拟。 – Marco